memos/web/src
Lincoln Nogueira 557278fac0
feat: improve i18n support as a whole (#1526)
* feat: improve i18n support as a whole

- Remove dayjs in favor of /helpers/datetime.ts, which uses
Intl.DateTimeFormat and Date. Dayjs is not exactly i18n friendly
and has several locale related opened issues.

- Move/refactor date/time code from /helpers/utils.ts to
/helpers/datetime.ts.

- Fix Daily Review weekday not changing according to selected date.

- Localize Daily review weekday and month.

- Load i18n listed strings from /locales/{locale}.json in a dynamic way.
This makes much easier to add new locales, by just adding a properly
named json file and listing it only in /web/src/i18n.ts and
/api/user_setting.go.

- Fallback languages are now set in /web/src/i18n.ts.

- Full language codes are now preffered, but they fallback to 2-letter
codes when not available.

- The locale dropdown is now populated dynamically from the available
locales. Locale names are populated by the browser via
Intl.DisplayNames(locale).

- /web/src/i18n.ts now exports a type TLocale from availableLocales
array. This is used only by findNearestLanguageMatch(). As I was unable
to use this type in ".d.ts" files, I switched the Locale type from
/web/src/types/i18n.d.ts to string.

- Move pretty much all hardcoded text strings to i18n strings.

- Add pt-BR translation.

- Remove site.ts and move its content to a i18n string.

- Rename zh.json to zh-Hans.json to get the correct language name on
selector dropdown.

- Remove pt_BR.json and replace with pt-BR.json.

- Some minor layout spacing fixes to accommodate larger texts.

- Improve some error messages.

* Delete .yarnrc.yml

* Delete package-lock.json

* fix: 158:28  error  Insert `⏎`  prettier/prettier
2023-04-15 08:56:03 +08:00
..
components feat: improve i18n support as a whole (#1526) 2023-04-15 08:56:03 +08:00
css fix(css): reorder the font fallback list (#1495) (#1496) 2023-04-09 09:48:42 +08:00
helpers feat: improve i18n support as a whole (#1526) 2023-04-15 08:56:03 +08:00
hooks chore: remove `useListStyle` hook (#1434) 2023-04-01 16:38:39 +08:00
labs chore: update import path (#1477) 2023-04-05 23:31:15 +08:00
layouts chore: add ignore version upgrade setting (#1491) 2023-04-08 18:13:51 +08:00
less feat: improve i18n support as a whole (#1526) 2023-04-15 08:56:03 +08:00
locales feat: improve i18n support as a whole (#1526) 2023-04-15 08:56:03 +08:00
pages feat: improve i18n support as a whole (#1526) 2023-04-15 08:56:03 +08:00
router refactor: update import prefix with alias (#1433) 2023-04-01 16:03:14 +08:00
store feat: improve i18n support as a whole (#1526) 2023-04-15 08:56:03 +08:00
theme chore: update resource dialog style (#982) 2023-01-21 08:46:49 +08:00
types feat: improve i18n support as a whole (#1526) 2023-04-15 08:56:03 +08:00
utils feat: improve i18n support as a whole (#1526) 2023-04-15 08:56:03 +08:00
App.tsx feat: improve i18n support as a whole (#1526) 2023-04-15 08:56:03 +08:00
i18n.ts feat: improve i18n support as a whole (#1526) 2023-04-15 08:56:03 +08:00
main.tsx feat: improve i18n support as a whole (#1526) 2023-04-15 08:56:03 +08:00