Skip to content

Commit

Permalink
feat: add i18n/transifex support
Browse files Browse the repository at this point in the history
  • Loading branch information
kabaros committed Jun 24, 2024
1 parent 3c42dbb commit 7c3d3af
Show file tree
Hide file tree
Showing 6 changed files with 77 additions and 335 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,5 @@ yarn-error.log*

lib/

.d2
.d2
locales/
10 changes: 10 additions & 0 deletions .tx/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[main]
host = https://www.transifex.com
lang_map = fa_AF: prs, uz@Cyrl: uz_UZ_Cyrl, uz@Latn: uz_UZ_Latn

[o:hisp-uio:p:multi-calendar-dates:r:en-pot]
file_filter = i18n/<lang>.po
source_file = i18n/en.pot
source_lang = en
type = PO
minimum_perc = 0
15 changes: 15 additions & 0 deletions i18n/en.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
msgid ""
msgstr ""
"Project-Id-Version: i18next-conv\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
"POT-Creation-Date: 2024-06-24T08:00:25.810Z\n"
"PO-Revision-Date: 2024-06-24T08:00:25.811Z\n"

msgid "Bi-Week"
msgstr "Bi-Week"

msgid "Week"
msgstr "Week"
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
}
},
"dependencies": {
"@dhis2/d2-i18n": "^1.1.3",
"@js-temporal/polyfill": "0.4.3",
"classnames": "^2.3.2"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import i18n from '@dhis2/d2-i18n'
import { Temporal } from '@js-temporal/polyfill'
import { SupportedCalendar } from '../../types'
import { fromAnyDate, formatYyyyMmDD, padWithZeroes } from '../../utils/index'
Expand Down Expand Up @@ -183,7 +184,8 @@ const buildLabel: BuildLabelFunc = ({
}) => {
const { year, month, day } = date
const { year: nextYear, month: nextMonth, day: nextDay } = nextWeek
const prefix = periodType === 'BIWEEKLY' ? 'Bi-Week' : 'Week'
const prefix =
periodType === 'BIWEEKLY' ? i18n.t('Bi-Week') : i18n.t('Week')
const label = `${prefix} ${weekIndex} - ${year}-${padWithZeroes(
month
)}-${padWithZeroes(day)} - ${nextYear}-${padWithZeroes(
Expand Down
Loading

0 comments on commit 7c3d3af

Please sign in to comment.