forked from coder/code-server
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add i18n in login page (coder#5947)
* feat: add i18n in login page * fix: add word space and put the app name into the title * fix: remove duplicate replace title * fix: prettier format code * fix: fix typescript check warning * fix: add zh-cn locale file code owner * fix: use existing flag locale to the login page Co-authored-by: Joe Previte <[email protected]>
- Loading branch information
1 parent
d40a974
commit 7c2aa8c
Showing
11 changed files
with
108 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import i18next, { init } from "i18next" | ||
import * as en from "./locales/en.json" | ||
import * as zhCn from "./locales/zh-cn.json" | ||
|
||
init({ | ||
lng: "en", | ||
fallbackLng: "en", // language to use if translations in user language are not available. | ||
returnNull: false, | ||
lowerCaseLng: true, | ||
debug: process.env.NODE_ENV === "development", | ||
resources: { | ||
en: { | ||
translation: en, | ||
}, | ||
"zh-cn": { | ||
translation: zhCn, | ||
}, | ||
}, | ||
}) | ||
|
||
export default i18next |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"LOGIN_TITLE": "{{app}} login", | ||
"LOGIN_BELOW": "Please log in below.", | ||
"WELCOME": "Welcome to {{app}}", | ||
"LOGIN_PASSWORD": "Check the config file at {{configFile}} for the password.", | ||
"LOGIN_USING_ENV_PASSWORD": "Password was set from $PASSWORD.", | ||
"LOGIN_USING_HASHED_PASSWORD": "Password was set from $HASHED_PASSWORD.", | ||
"SUBMIT": "SUBMIT", | ||
"PASSWORD_PLACEHOLDER": "PASSWORD", | ||
"LOGIN_RATE_LIMIT": "Login rate limited!", | ||
"MISS_PASSWORD": "Missing password", | ||
"INCORRECT_PASSWORD": "Incorrect password" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"LOGIN_TITLE": "{{app}} 登录", | ||
"LOGIN_BELOW": "请在下面登录。", | ||
"WELCOME": "欢迎来到 {{app}}", | ||
"LOGIN_PASSWORD": "查看配置文件 {{configFile}} 中的密码。", | ||
"LOGIN_USING_ENV_PASSWORD": "密码在 $PASSWORD 中设置。", | ||
"LOGIN_USING_HASHED_PASSWORD": "密码在 $HASHED_PASSWORD 中设置。", | ||
"SUBMIT": "提交", | ||
"PASSWORD_PLACEHOLDER": "密码", | ||
"LOGIN_RATE_LIMIT": "登录速率限制!", | ||
"MISS_PASSWORD": "缺少密码", | ||
"INCORRECT_PASSWORD": "密码不正确" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,13 @@ | |
# yarn lockfile v1 | ||
|
||
|
||
"@babel/runtime@^7.20.6": | ||
version "7.20.7" | ||
resolved "https://registry.npmmirror.com/@babel/runtime/-/runtime-7.20.7.tgz#fcb41a5a70550e04a7b708037c7c32f7f356d8fd" | ||
integrity sha512-UF0tvkUtxwAgZ5W/KrkHf0Rn0fdnLDU9ScxBrEVNUprE/MzirjK4MJUX1/BVDv00Sv8cljtukVK1aky++X1SjQ== | ||
dependencies: | ||
regenerator-runtime "^0.13.11" | ||
|
||
"@coder/logger@^3.0.0": | ||
version "3.0.0" | ||
resolved "https://registry.yarnpkg.com/@coder/logger/-/logger-3.0.0.tgz#fd4d2332ca375412c75cb5ba7767d3290b106dec" | ||
|
@@ -1814,6 +1821,13 @@ https-proxy-agent@5, https-proxy-agent@^5.0.0: | |
agent-base "6" | ||
debug "4" | ||
|
||
i18next@^22.4.6: | ||
version "22.4.6" | ||
resolved "https://registry.npmmirror.com/i18next/-/i18next-22.4.6.tgz#876352c3ba81bdfedc38eeda124e2bbd05f46988" | ||
integrity sha512-9Tm1ezxWyzV+306CIDMBbYBitC1jedQyYuuLtIv7oxjp2ohh8eyxP9xytIf+2bbQfhH784IQKPSYp+Zq9+YSbw== | ||
dependencies: | ||
"@babel/runtime" "^7.20.6" | ||
|
||
[email protected]: | ||
version "0.4.24" | ||
resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b" | ||
|
@@ -2873,6 +2887,11 @@ [email protected]: | |
resolved "https://registry.yarnpkg.com/readline-transform/-/readline-transform-1.0.0.tgz#3157f97428acaec0f05a5c1ff2c3120f4e6d904b" | ||
integrity sha512-7KA6+N9IGat52d83dvxnApAWN+MtVb1MiVuMR/cf1O4kYsJG+g/Aav0AHcHKsb6StinayfPLne0+fMX2sOzAKg== | ||
|
||
regenerator-runtime@^0.13.11: | ||
version "0.13.11" | ||
resolved "https://registry.npmmirror.com/regenerator-runtime/-/regenerator-runtime-0.13.11.tgz#f6dca3e7ceec20590d07ada785636a90cdca17f9" | ||
integrity sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg== | ||
|
||
regexp.prototype.flags@^1.4.3: | ||
version "1.4.3" | ||
resolved "https://registry.yarnpkg.com/regexp.prototype.flags/-/regexp.prototype.flags-1.4.3.tgz#87cab30f80f66660181a3bb7bf5981a872b367ac" | ||
|