memos/api
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
..
activity.go chore: update memo create activity (#903) 2023-01-03 23:49:11 +08:00
auth.go feat: implement sign in with SSO (#1119) 2023-02-19 09:50:30 +08:00
common.go chore: update signup api (#1067) 2023-02-11 15:15:56 +08:00
idp.go fix: idp config definition (#1115) 2023-02-18 18:31:03 +08:00
memo.go fix: find memo list order (#1149) 2023-02-24 20:34:54 +08:00
memo_organizer.go fix: access control (#870) 2022-12-28 20:22:52 +08:00
memo_resource.go fix: access control (#870) 2022-12-28 20:22:52 +08:00
resource.go feat: add public id field to resource (#1451) 2023-04-03 13:41:27 +08:00
shortcut.go fix: access control (#870) 2022-12-28 20:22:52 +08:00
storage.go chore: update version and remove isDev flag (#1452) 2023-04-03 14:13:22 +08:00
system.go chore: add ignore version upgrade setting (#1491) 2023-04-08 18:13:51 +08:00
system_setting.go chore: add ignore version upgrade setting (#1491) 2023-04-08 18:13:51 +08:00
tag.go fix: delete tag (#1062) 2023-02-10 23:57:02 +08:00
user.go fix: patch user with nil password (#1290) 2023-03-06 19:13:09 +08:00
user_setting.go feat: improve i18n support as a whole (#1526) 2023-04-15 08:56:03 +08:00