Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support localization for Nav components #688

Merged
merged 31 commits into from
Jul 24, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
1deba34
init localization
NoahDragon Jun 27, 2023
1870606
Merge https://github.com/danny-avila/LibreChat
NoahDragon Jun 27, 2023
c0c5b2a
Update defaul to en
NoahDragon Jun 27, 2023
00c612c
Merge branch 'main' of https://github.com/danny-avila/LibreChat into …
NoahDragon Jun 27, 2023
773418a
Fix merge issue and import path.
NoahDragon Jun 27, 2023
b313db7
Set default to en
NoahDragon Jun 27, 2023
6c8f47c
Merge branch 'main' of https://github.com/NoahDragon/LibreChat into main
NoahDragon Jun 27, 2023
b2b4a2d
Change jsx to tsx
NoahDragon Jun 27, 2023
cc619b8
Merge branch 'main' of https://github.com/danny-avila/LibreChat into …
NoahDragon Jun 27, 2023
78cb0b3
Merge main http://github.com/danny-avila/LibreChat
NoahDragon Jul 7, 2023
67da8a2
Update the password max length string.
NoahDragon Jul 7, 2023
98df1cd
Merge branch 'main' into main
NoahDragon Jul 7, 2023
fe7199e
Remove languageContext as using the recoil instead.
NoahDragon Jul 11, 2023
4f68b55
Merge branch 'main' of https://github.com/danny-avila/LibreChat into …
NoahDragon Jul 11, 2023
f73e592
Merge branch 'main' of https://github.com/NoahDragon/LibreChat into main
NoahDragon Jul 11, 2023
ad5aba4
Merge branch 'main' of https://github.com/danny-avila/LibreChat into …
NoahDragon Jul 12, 2023
62ad300
Add localization to component endpoints pages
NoahDragon Jul 19, 2023
69035c5
Revert default to en after testing.
NoahDragon Jul 19, 2023
c5f9da2
Merge branch 'main' of https://github.com/danny-avila/LibreChat into …
NoahDragon Jul 19, 2023
b7a413d
Update LoginForm.tsx
NoahDragon Jul 19, 2023
02eb6a7
Fix translation.
NoahDragon Jul 19, 2023
d72c1d5
Merge branch 'main' of https://github.com/NoahDragon/LibreChat into main
NoahDragon Jul 19, 2023
b048a17
Merge branch 'main' into main
NoahDragon Jul 22, 2023
abcfb76
Merge branch 'main' into main
NoahDragon Jul 22, 2023
28d86ad
Make lint happy
NoahDragon Jul 22, 2023
babc542
Merge branch 'main' of https://github.com/danny-avila/LibreChat into …
NoahDragon Jul 23, 2023
44cdb0e
Merge (#1)
NoahDragon Jul 23, 2023
861f849
Translate Nav pages
NoahDragon Jul 23, 2023
695c35b
Merge branch 'main' of https://github.com/NoahDragon/LibreChat into main
NoahDragon Jul 23, 2023
10aa6f2
Fix npm test
NoahDragon Jul 23, 2023
dd2264a
Merge branch 'main' into main
NoahDragon Jul 23, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Change jsx to tsx
  • Loading branch information
NoahDragon committed Jun 27, 2023
commit b2b4a2db7c86f0a1708f9c6c0f252d6355adf04a
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ import Chinese from './languages/Zh';

// input: language code in string
// returns an object of translated strings in the language
export const getTranslations = (langCode) => {
export const getTranslations = (langCode: string) => {
if (langCode === 'en') return English;
if (langCode === 'cn') return Chinese;
// === add conditionals here for additional languages here === //
};

// input: language code in string & phrase key in string
// returns an corresponding phrase value in string
export const localize = (langCode, phraseKey) => {
export const localize = (langCode: string, phraseKey: string) => {
const lang = getTranslations(langCode);
return lang[phraseKey];
};