mirror of
https://github.com/siteboon/claudecodeui.git
synced 2026-07-03 02:52:59 +08:00
add i18n feat && Add partial translation
This commit is contained in:
48
src/i18n/languages.js
Normal file
48
src/i18n/languages.js
Normal file
@@ -0,0 +1,48 @@
|
||||
/**
|
||||
* Supported Languages Configuration
|
||||
*
|
||||
* This file contains the list of supported languages for the application.
|
||||
* Each language includes:
|
||||
* - value: Language code (e.g., 'en', 'zh-CN')
|
||||
* - label: Display name in English
|
||||
* - nativeName: Native language name for display
|
||||
*/
|
||||
|
||||
export const languages = [
|
||||
{
|
||||
value: 'en',
|
||||
label: 'English',
|
||||
nativeName: 'English',
|
||||
},
|
||||
{
|
||||
value: 'zh-CN',
|
||||
label: 'Simplified Chinese',
|
||||
nativeName: '简体中文',
|
||||
},
|
||||
];
|
||||
|
||||
/**
|
||||
* Get language object by value
|
||||
* @param {string} value - Language code
|
||||
* @returns {Object|undefined} Language object or undefined if not found
|
||||
*/
|
||||
export const getLanguage = (value) => {
|
||||
return languages.find(lang => lang.value === value);
|
||||
};
|
||||
|
||||
/**
|
||||
* Get all language values
|
||||
* @returns {string[]} Array of language codes
|
||||
*/
|
||||
export const getLanguageValues = () => {
|
||||
return languages.map(lang => lang.value);
|
||||
};
|
||||
|
||||
/**
|
||||
* Check if a language is supported
|
||||
* @param {string} value - Language code to check
|
||||
* @returns {boolean} True if language is supported
|
||||
*/
|
||||
export const isLanguageSupported = (value) => {
|
||||
return languages.some(lang => lang.value === value);
|
||||
};
|
||||
Reference in New Issue
Block a user