memos/web
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
..
.vscode feat: new resource dashboard (#1346) 2023-03-15 20:06:30 +08:00
e2e-tests feat: add e2e test (#1486) 2023-04-11 22:13:06 +08:00
public chore: update logo (#1442) 2023-04-02 09:54:52 +08:00
src feat: improve i18n support as a whole (#1526) 2023-04-15 08:56:03 +08:00
.eslintrc.json chore: update links reference (#1243) 2023-03-04 15:06:01 +08:00
.gitignore feat: add e2e test (#1486) 2023-04-11 22:13:06 +08:00
.prettierrc migrate frontend 2021-12-08 23:43:52 +08:00
index.html chore: update logo (#1442) 2023-04-02 09:54:52 +08:00
package.json feat: improve i18n support as a whole (#1526) 2023-04-15 08:56:03 +08:00
playwright.config.ts feat: add e2e test (#1486) 2023-04-11 22:13:06 +08:00
postcss.config.js feat: use tailwindcss and show export btn 2022-01-31 19:16:01 +08:00
README.md migrate frontend 2021-12-08 23:43:52 +08:00
tailwind.config.js feat: limit the num of lines for filename (#1424) 2023-03-29 20:27:54 +08:00
tsconfig.json refactor: update import prefix with alias (#1433) 2023-04-01 16:03:14 +08:00
vite.config.ts refactor: declare variable for devProxyServer (#1220) 2023-03-01 19:50:43 +08:00
yarn.lock feat: improve i18n support as a whole (#1526) 2023-04-15 08:56:03 +08:00

Memos web