- Notifications
You must be signed in to change notification settings - Fork6.1k
Add comprehensive login page customization options#7374
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Open
strickvl wants to merge19 commits intocoder:mainChoose a base branch fromstrickvl:main
base:main
Could not load branches
Branch not found:{{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline, and old review comments may become outdated.
+471 −23
Open
Changes fromall commits
Commits
Show all changes
19 commits Select commitHold shift + click to select a range
cd99956
feat: add comprehensive login page customization options
strickvlbac8b42
Merge branch 'main' into main
strickvl2553f45
feat: replace individual UI flags with unified --custom-strings flag
strickvlc2eb61d
docs: simplify migration guide to only cover released flags
strickvlc0189ed
docs: update Docker customization examples to use --custom-strings
strickvlcacf3cc
Merge branch 'main' into main
strickvl2b2819e
docs: remove niche customization sections from FAQ and install guide
strickvlb275d52
refactor: remove redundant custom-strings validation and global variable
strickvlaf2f599
refactor: simplify loadCustomStrings function signature and error han…
strickvle89a9af
test: remove outdated tests for deprecated custom UI flags
strickvla8b7fbe
refactor: use addResourceBundle instead of re-initializing i18next
strickvl27ee714
docs: improve custom-strings flag description
strickvld5c0c88
refactor: keep --app-name flag as non-deprecated for {{app}} placeholder
strickvlfd6ca51
refactor: rename --custom-strings flag to --i18n
strickvlca12a25
docs: consolidate i18n documentation in guide.md
strickvldceb0a6
refactor: simplify --i18n flag to file-only approach
strickvl9bf53dc
CI fixes
strickvl354677c
Merge branch 'main' into main
strickvl0d4bd15
Address test coverage
strickvlFile filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 |
---|---|---|
@@ -1,33 +1,59 @@ | ||
import { promises as fs } from "fs" | ||
import i18next, { init } from "i18next" | ||
import * as en from "./locales/en.json" | ||
import * as ja from "./locales/ja.json" | ||
import * as th from "./locales/th.json" | ||
import * as ur from "./locales/ur.json" | ||
import * as zhCn from "./locales/zh-cn.json" | ||
const defaultResources = { | ||
en: { | ||
translation: en, | ||
}, | ||
"zh-cn": { | ||
translation: zhCn, | ||
}, | ||
th: { | ||
translation: th, | ||
}, | ||
ja: { | ||
translation: ja, | ||
}, | ||
ur: { | ||
translation: ur, | ||
}, | ||
} | ||
export async function loadCustomStrings(filePath: string): Promise<void> { | ||
try { | ||
// Read custom strings from file path only | ||
const fileContent = await fs.readFile(filePath, "utf8") | ||
const customStringsData = JSON.parse(fileContent) | ||
// User-provided strings override all languages. | ||
Object.keys(defaultResources).forEach((locale) => { | ||
i18next.addResourceBundle(locale, "translation", customStringsData) | ||
}) | ||
} catch (error) { | ||
if (error && typeof error === "object" && "code" in error && error.code === "ENOENT") { | ||
throw new Error(`Custom strings file not found: ${filePath}\nPlease ensure the file exists and is readable.`) | ||
} else if (error instanceof SyntaxError) { | ||
throw new Error(`Invalid JSON in custom strings file: ${filePath}\n${error.message}`) | ||
} else { | ||
throw new Error( | ||
`Failed to load custom strings from ${filePath}: ${error instanceof Error ? error.message : String(error)}`, | ||
) | ||
} | ||
} | ||
} | ||
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: defaultResources, | ||
}) | ||
export default i18next |
This file contains hidden or 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 hidden or 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 hidden or 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
Oops, something went wrong.
Uh oh!
There was an error while loading.Please reload this page.
Oops, something went wrong.
Uh oh!
There was an error while loading.Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.