feat(i18n): implement dynamic system wording management
Add database schema and API endpoints for system wording keys and values Replace hardcoded translations in frontend and backend with dynamic messages Add System Wordings management interface to Admin view
This commit is contained in:
@@ -17,7 +17,7 @@ import {
|
||||
iconPokemon,
|
||||
iconRecipe
|
||||
} from './icons';
|
||||
import { getCurrentLocale, onLocaleChange, setCurrentLocale } from './i18n';
|
||||
import { getCurrentLocale, loadSystemWordings, onLocaleChange, setCurrentLocale } from './i18n';
|
||||
import { api, getAuthToken, onAuthTokenChange, setAuthToken, type AuthUser, type Language } from './services/api';
|
||||
|
||||
const { t, locale } = useI18n();
|
||||
@@ -87,12 +87,15 @@ async function loadLanguages() {
|
||||
if (!languages.value.some((language) => language.code === getCurrentLocale() && language.enabled)) {
|
||||
setCurrentLocale('en');
|
||||
}
|
||||
|
||||
await loadSystemWordings(getCurrentLocale());
|
||||
} catch {
|
||||
// Keep the built-in language list when the API is not ready yet.
|
||||
}
|
||||
}
|
||||
|
||||
function updateLocale(value: string) {
|
||||
async function updateLocale(value: string) {
|
||||
await loadSystemWordings(value);
|
||||
setCurrentLocale(value);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user