Skip to content

Commit

Permalink
chore: support fr locale
Browse files Browse the repository at this point in the history
  • Loading branch information
boojack committed May 21, 2024
1 parent 4444c72 commit 6746b9d
Show file tree
Hide file tree
Showing 17 changed files with 216 additions and 197 deletions.
4 changes: 4 additions & 0 deletions frontend/web/src/components/setting/PreferenceSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ const PreferenceSection: React.FC = () => {
value: UserSetting_Locale.LOCALE_ZH,
label: "中文",
},
{
value: UserSetting_Locale.LOCALE_FR,
label: "Français",
},
];

const colorThemeOptions = [
Expand Down
4 changes: 4 additions & 0 deletions frontend/web/src/i18n.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import i18n from "i18next";
import { initReactI18next } from "react-i18next";
import en from "../../locales/en.json";
import fr from "../../locales/fr.json";
import zh from "../../locales/zh.json";

i18n.use(initReactI18next).init({
Expand All @@ -11,6 +12,9 @@ i18n.use(initReactI18next).init({
zh: {
translation: zh,
},
fr: {
translation: fr,
},
},
lng: "en",
fallbackLng: "en",
Expand Down
2 changes: 2 additions & 0 deletions frontend/web/src/layouts/Root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ const Root: React.FC = () => {

if (isEqual(currentUserSetting.locale, UserSetting_Locale.LOCALE_ZH)) {
i18n.changeLanguage("zh");
} else if (isEqual(currentUserSetting.locale, UserSetting_Locale.LOCALE_FR)) {
i18n.changeLanguage("fr");
} else {
i18n.changeLanguage("en");
}
Expand Down
1 change: 1 addition & 0 deletions proto/api/v1/user_setting_service.proto
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ message UserSetting {
LOCALE_UNSPECIFIED = 0;
LOCALE_EN = 1;
LOCALE_ZH = 2;
LOCALE_FR = 3;
}
// locale is the user locale.
Locale locale = 2;
Expand Down
1 change: 1 addition & 0 deletions proto/gen/api/v1/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1360,6 +1360,7 @@
| LOCALE_UNSPECIFIED | 0 | |
| LOCALE_EN | 1 | |
| LOCALE_ZH | 2 | |
| LOCALE_FR | 3 | |



Expand Down
140 changes: 72 additions & 68 deletions proto/gen/api/v1/user_setting_service.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions proto/gen/apidocs.swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -738,6 +738,7 @@ definitions:
- LOCALE_UNSPECIFIED
- LOCALE_EN
- LOCALE_ZH
- LOCALE_FR
default: LOCALE_UNSPECIFIED
apiv1AutoBackupWorkspaceSetting:
type: object
Expand Down
17 changes: 9 additions & 8 deletions proto/gen/store/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -294,9 +294,9 @@
| Name | Number | Description |
| ---- | ------ | ----------- |
| COLOR_THEME_USER_SETTING_UNSPECIFIED | 0 | |
| COLOR_THEME_USER_SETTING_SYSTEM | 1 | |
| COLOR_THEME_USER_SETTING_LIGHT | 2 | |
| COLOR_THEME_USER_SETTING_DARK | 3 | |
| SYSTEM | 1 | |
| LIGHT | 2 | |
| DARK | 3 | |



Expand All @@ -308,8 +308,9 @@
| Name | Number | Description |
| ---- | ------ | ----------- |
| LOCALE_USER_SETTING_UNSPECIFIED | 0 | |
| LOCALE_USER_SETTING_EN | 1 | |
| LOCALE_USER_SETTING_ZH | 2 | |
| EN | 1 | |
| ZH | 2 | |
| FR | 3 | |



Expand All @@ -321,9 +322,9 @@
| Name | Number | Description |
| ---- | ------ | ----------- |
| USER_SETTING_KEY_UNSPECIFIED | 0 | |
| USER_SETTING_ACCESS_TOKENS | 1 | Access tokens for the user. |
| USER_SETTING_LOCALE | 2 | Locale for the user. |
| USER_SETTING_COLOR_THEME | 3 | Color theme for the user. |
| ACCESS_TOKENS | 1 | Access tokens for the user. |
| LOCALE | 2 | Locale for the user. |
| COLOR_THEME | 3 | Color theme for the user. |



Expand Down
Loading

0 comments on commit 6746b9d

Please sign in to comment.