Skip to content

Commit

Permalink
Fixed farsi translation issue (fixes #247) (#248)
Browse files Browse the repository at this point in the history
To make sure the same mistake won't happen again, I first converted the
en.json file to use newlines instead of `|` using the following js
snippet:

```js
JSON.stringify(Object.entries(en).map(([name,data])=>({name,value:data.split('|')})))
```

Then translated it this way:

```json
[
  {
    "name": "name",
    "value": [
      "Farsi"
    ]
  },
  {
    "name": "months",
    "value": [
      "ژانویه",
      "فوریه",
      "مارس",
      "آوریل",
      "مه",
      "ژوئن",
      "ژوئیه",
      "اوت",
      "سپتامبر",
      "اکتبر",
      "نوامبر",
      "دسامبر"
    ]
  },
  {
    "name": "short_months",
    "value": [
      "ژانویه",
      "فوریه",
      "مارس",
      "آوریل",
      "مه",
      "ژوئن",
      "ژوئیه",
      "اوت",
      "سپتامبر",
      "اکتبر",
      "نوامبر",
      "دسامبر"
    ]
  },
  {
    "name": "weeks",
    "value": [
      "یکشنبه",
      "دوشنبه",
      "سه‌شنبه",
      "چهارشنبه",
      "پنجشنبه",
      "جمعه",
      "شنبه"
    ]
  },
  {
    "name": "short_weeks",
    "value": [
      "یکشنبه",
      "دوشنبه",
      "سه‌شنبه",
      "چهارشنبه",
      "پنجشنبه",
      "جمعه",
      "شنبه"
    ]
  },
  {
    "name": "seasons",
    "value": [
      "بهار",
      "تابستان",
      "پاییز",
      "زمستان"
    ]
  },
  {
    "name": "constellations",
    "value": [
      "قوچ",
      "گاو نر",
      "دو پیکر",
      "خرچنگ",
      "شیر",
      "خوشه",
      "ترازو",
      "عقرب",
      "کماندار",
      "بز",
      "آبریز",
      "ماهی"
    ]
  },
  {
    "name": "year",
    "value": [
      "1 سال",
      "%d سال"
    ]
  },
  {
    "name": "month",
    "value": [
      "1 ماه",
      "%d ماه"
    ]
  },
  {
    "name": "week",
    "value": [
      "1 هفته",
      "%d هفته"
    ]
  },
  {
    "name": "day",
    "value": [
      "1 روز",
      "%d روز"
    ]
  },
  {
    "name": "hour",
    "value": [
      "1 ساعت",
      "%d ساعت"
    ]
  },
  {
    "name": "minute",
    "value": [
      "1 دقیقه",
      "%d دقیقه"
    ]
  },
  {
    "name": "second",
    "value": [
      "1 ثانیه",
      "%d ثانیه"
    ]
  },
  {
    "name": "now",
    "value": [
      "همین الان"
    ]
  },
  {
    "name": "ago",
    "value": [
      "%s پیش"
    ]
  },
  {
    "name": "from_now",
    "value": [
      "در %s"
    ]
  },
  {
    "name": "before",
    "value": [
      "%s قبل"
    ]
  },
  {
    "name": "after",
    "value": [
      "%s بعد"
    ]
  }
]
```

Then converted it back using:

```js
JSON.stringify(x.reduce((a,e)=>(a[e.name]=e.value.join('|'),a), {}))
```

from the diff it seems there were more issues with order of month/days
as well. in general I don't recommend merging values and using
non-standard separators. this could've been avoided if the format
defined months as an array and used separate keys for one vs many cases.
  • Loading branch information
gouguoyin authored Sep 29, 2024
2 parents 89406e3 + 0a3eff6 commit b318eec
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions lang/fa.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
{
"name": "Farsi",
"months": "دسامبر|نوامبر|اکتبر|سپتامبر|اوت|ژوئیه|ژوئن|مه|آوریل|مارس|فوریه|ژانویه",
"short_months": "دسامبر|نوامبر|اکتبر|سپتامبر|اوت|ژوئیه|ژوئن|مه|آوریل|مارس|فوریه|ژانویه",
"weeks": "شنبه|جمعه|پنجشنبه|چهارشنبه|سه شنبه|دوشنبه|یکشنبه",
"short_weeks": "شنبه|جمعه|پنجشنبه|چهارشنبه|سه شنبه|دوشنبه|یکشنبه",
"seasons": "زمستان|پاییز|تابستان|بهار",
"constellations": "ماهی|آبریز|بز|کمان|عقرب|ترازو|خوشه|شیر|خرچنگ|دوپیکر|گاو نر|قوچ",
"year": "سال|۱ سال %d",
"month": "ماه|۱ ماه %d",
"week": "هفته|۱ هفته %d",
"day": "روز|۱ روز %d",
"hour": "ساعت|۱ ساعت %d",
"minute": "دقیقه|۱ دقیقه %d",
"second": "ثانیه|۱ ثانیه %d",
"now": "الان",
"ago": "قبل %s",
"from_now": "از الان %s",
"before": "قبل %s",
"after": "بعد %s"
}
"months": "ژانویه|فوریه|مارس|آوریل|مه|ژوئن|ژوئیه|اوت|سپتامبر|اکتبر|نوامبر|دسامبر",
"short_months": "ژانویه|فوریه|مارس|آوریل|مه|ژوئن|ژوئیه|اوت|سپتامبر|اکتبر|نوامبر|دسامبر",
"weeks": "یکشنبه|دوشنبه|سه‌شنبه|چهارشنبه|پنجشنبه|جمعه|شنبه",
"short_weeks": "یکشنبه|دوشنبه|سه‌شنبه|چهارشنبه|پنجشنبه|جمعه|شنبه",
"seasons": "بهار|تابستان|پاییز|زمستان",
"constellations": "قوچ|گاو نر|دو پیکر|خرچنگ|شیر|خوشه|ترازو|عقرب|کماندار|بز|آبریز|ماهی",
"year": "1 سال|%d سال",
"month": "1 ماه|%d ماه",
"week": "1 هفته|%d هفته",
"day": "1 روز|%d روز",
"hour": "1 ساعت|%d ساعت",
"minute": "1 دقیقه|%d دقیقه",
"second": "1 ثانیه|%d ثانیه",
"now": "همین الان",
"ago": "%s پیش",
"from_now": "در %s",
"before": "%s قبل",
"after": "%s بعد"
}

0 comments on commit b318eec

Please sign in to comment.