Skip to content

Translating

ezBookkeeping supports multiple languages and localization settings, with separate language files for the frontend and backend. The frontend language files are located in /src/locales/, and the backend language files are in /pkg/locales/. All language files should be named using language tags (either a single language subtag or a language subtag with a script subtag, such as en, fr, zh-Hans or zh-Hant).

For more information about language tags, please refer to RFC5646. All available language tags can be found in IANA registry language-subtag-registry.

Add new language for frontend

  1. Copy /src/locales/en.json and create a new file named with the language tag
  2. Add a key-value pair to the allLanguages object in /src/locales/index.ts. The key should be the language tag, and the value should be an object with the following fields:
    1. name field is the language name in English
    2. displayName field is the language name in its own language
    3. alternativeLanguageTag field is the language tag in the language-region format (e.g. zh-CN), used for compatibility with some third-party services that don't support language tags in the language-script format
    4. textDirection field is the text direction, supports ltr (left-to-right) or rtl (right-to-left)
    5. content field is the dictionary object for this language
  3. Translate each text item

Add new language for backend

  1. Copy /pkg/locales/en.go and create a new file named with the language tag
  2. Add a key-value pair to the AllLanguages map in /pkg/locales/all_locales.go. The key should be the language tag, and the Content field in the value object should be the new language object
  3. Translate each text item

Internationalization

ezBookkeeping allows users to change multiple regional settings, such as date, time, numeral, and currency formats. If the user does not change these settings, the default values configured in the language files will be used. These default values are in the default object of the language file.

Here are all the settings that require default values and their descriptions:

ItemAll Available OptionsDescription
currencyALL_CURRENCIES in /src/consts/currency.tsThe default currency
firstDayOfWeekWeekDay in /src/core/datetime.tsThe default first day of the week, supports Sunday, Monday, Tuesday, Wednesday, Thursday, Friday and Saturday
fiscalYearFormatFiscalYearFormat in /src/core/fiscalyear.tsThe default fiscal year format, supports StartYYYY_EndYYYY, StartYYYY_EndYY, StartYY_EndYY, EndYYYY and EndYY
calendarDisplayTypeCalendarDisplayType in /src/core/calendar.tsThe default calendar used by the calendar component and month list, supports Gregorian, Buddhist, GregorianWithChinese and GregorianWithPersian
dateDisplayTypeDateDisplayType in /src/core/calendar.tsThe default calendar used when displaying dates, supports Gregorian, Buddhist and Persian
longDateFormatLongDateFormat in /src/core/datetime.tsThe default long date format, supports YYYYMMDD (Year Month Day), MMDDYYYY (Month Day Year) and DDMMYYYY (Day Month Year)
shortDateFormatShortDateFormat in /src/core/datetime.tsThe default short date format, supports YYYYMMDD (Year Month Day), MMDDYYYY (Month Day Year) and DDMMYYYY (Day Month Year)
longTimeFormatLongTimeFormat in /src/core/datetime.tsThe default long time format, supports HHMMSS (24-hour time format), AHHMMSS (12-hour time format, AM/PM before the time) and HHMMSSA (12-hour time format, AM/PM after the time)
shortTimeFormatShortTimeFormat in /src/core/datetime.tsThe default short time format, supports HHMMSS (24-hour time format), AHHMMSS (12-hour time format, AM/PM before the time) and HHMMSSA (12-hour time format, AM/PM after the time)
currencyDisplayTypeCurrencyDisplayType in /src/core/currency.tsThe default currency display type, supports None, SymbolBeforeAmount, SymbolAfterAmount, SymbolBeforeAmountWithoutSpace, SymbolAfterAmountWithoutSpace, CodeBeforeAmount, CodeAfterAmount, UnitBeforeAmount, UnitAfterAmount, NameBeforeAmount and NameAfterAmount
numeralSystemNumeralSystem in /src/core/numeral.tsThe default numeral system, supports WesternArabicNumerals, EasternArabicNumerals, PersianDigits, BurmeseNumerals and DevanagariNumerals
decimalSeparatorDecimalSeparator in /src/core/numeral.tsThe default decimal separator, supports Dot and Comma
digitGroupingSymbolDigitGroupingSymbol in /src/core/numeral.tsThe default digit grouping symbol, supports Dot, Comma, Space and Apostrophe
digitGroupingDigitGroupingType in /src/core/numeral.tsThe default digit grouping type, supports None and ThousandsSeparator

In addition, the format object in the language files defines date formats (Year–Month–Day, Month–Day–Year and Day–Month–Year) and time formats (24-hour clock, 12-hour clock with AM/PM before the time and 12-hour clock with AM/PM after the time) of various lengths. The following placeholders are supported:

PlaceholderDescriptionExample
YYTwo-digit Year99, 00, 25
YYYYFour-digit Year1999, 2000, 2025
MMonth1, 2, 11
MMTwo-digit Month01, 02, 11
MMMAbbreviated Month NameJan, Feb, Nov
MMMMFull Month NameJanuary, February, November
DDay of Month1, 10, 28
DDTwo-digit Day of Month01, 10, 28
ddShortest Weekday AbbreviationSu, Mo, Fr
dddWeekday AbbreviationSun, Mon, Fri
ddddFull Weekday NameSunday, Monday, Friday
HHour (24-hour clock)0, 13, 23
HHTwo-digit Hour (24-hour clock)00, 13, 23
hHour (12-hour clock)12, 1, 11
hhTwo-digit Hour (12-hour clock)12, 01, 11
mMinutes0, 10, 59
mmTwo-digit Minutes00, 10, 59
sSeconds0, 10, 59
ssTwo-digit Seconds00, 10, 59
AAM or PMAM, PM
ZTimezone Offset in Minutes+08:00, +00:00, -05:00

These date and time formats are used in the following scenarios:

ItemUsage Scenarios
longDateMultiple scenarios
shortDateMultiple scenarios
longYearUsed in the overview data on the homepage
shortYearUsed in the time filters on the transaction and statistics analysis pages
longYearMonthUsed when displaying months in the transaction list
shortYearMonthUsed in the time filters on the transaction and statistics analysis pages
longMonthDayUsed in the overview data on the homepage
shortMonthDayUsed in the time filters on the transaction and statistics analysis pages. It will be displayed next to the shortDate and should have a similar format.
shortDayUsed when displaying days in the transaction list
longTimeMultiple scenarios
shortTimeMultiple scenarios

In addition, the timezone data is sourced from nodatime, and the localized timezone names are taken from TimeZoneNames

Released under the MIT License.