Project Files
docs / I18N.md
RAG-Flex uses a dual-layer language mechanism to provide a truly multilingual experience:
Determined by system language
Examples:
Selected by user in settings
Examples:
| Component | Language Used | How to Switch | When Applied |
|---|---|---|---|
| Configuration UI Labels | System Language | Change system language + restart plugin | Plugin startup |
| Message Language Selector | System Language | Change system language + restart plugin | Plugin startup |
| Other Config Labels | System Language | Change system language + restart plugin | Plugin startup |
| Status Messages | Message Language | Select in settings | Immediately |
| Error Messages | Message Language | Select in settings | Immediately |
| LLM System Prompts | Message Language | Select in settings | Immediately |
Situation: System is Traditional Chinese, want full Chinese experience
Setup:
Result:
Situation: System is English, but want Chinese messages
Setup:
Result:
Situation: Want to see Chinese-English side-by-side for learning technical terms
Setup:
Result:
This is an LM Studio SDK limitation, not a design flaw:
SDK Limitations:
withConfigSchematics() can only be called onceOur Solution:
LANG (most common)LANGUAGE (fallback)LC_ALL (locale override)Environment Variable Setup (Advanced):
Terminal Setup:
Temporary Setup (Current Session):
Permanent Setup:
Select English (en):
Select 繁體中文 (zh-TW):
Select 日本語 (ja):
Recommended Configuration:
Recommended Configuration:
Advantages:
Testing Recommendations:
A: This is designed behavior, not a bug.
To change configuration UI language, change system language and restart plugin.
A: Two-step setup:
After restarting plugin, all content will be in Chinese.
A: Not yet, but planned for future versions.
For contributing Simplified Chinese translations, see src/locales/README.md.
A: Yes! See:
src/locales/README.mdsrc/locales/README.zh-TW.mdsrc/locales/README.ja.mdAdding a new language takes only 5 steps. Contributions welcome!
This dual-layer language mechanism is designed based on these principles:
Thanks to the LM Studio team for providing an excellent plugin SDK that enables us to build this multilingual system.
Last Updated: 2026-01-03 Version: v1.1.0
English (en)繁體中文 (zh-TW)日本語 (ja)// Plugin lifecycle
export async function main(context: PluginContext) {
// 1. Detect system language
const systemLang = detectSystemLanguage();
// 2. Generate configuration UI (using system language)
const config = createDynamicConfig(models, systemLang);
// 3. Register with LM Studio (configuration UI is now fixed)
context.withConfigSchematics(config);
// ↑
// Cannot be changed after this
}
export function detectSystemLanguage(): SupportedLanguage {
const envLang = process.env.LANG ||
process.env.LANGUAGE ||
process.env.LC_ALL || "";
// Traditional Chinese (Taiwan, Hong Kong, Macau)
if (envLang.includes("zh_TW") ||
envLang.includes("zh-TW") ||
envLang.includes("zh_HK")) {
return "zh-TW";
}
// Japanese
if (envLang.includes("ja") ||
envLang.includes("jp")) {
return "ja";
}
// Simplified Chinese (temporarily mapped to Traditional, future support)
if (envLang.includes("zh_CN") ||
envLang.includes("zh-CN")) {
return "zh-TW"; // TODO: Add zh-CN support
}
// Default to English
return "en";
}
set LANG=zh_TW.UTF-8
set LANG=en_US.UTF-8
set LANG=ja_JP.UTF-8
export LANG=zh_TW.UTF-8
export LANG=en_US.UTF-8
export LANG=ja_JP.UTF-8
export LANG=zh_TW.UTF-8
lms dev
# Edit ~/.bashrc or ~/.zshrc
echo 'export LANG=zh_TW.UTF-8' >> ~/.bashrc
source ~/.bashrc
lms dev
Loading embedding model: bge-m3...
Retrieving relevant citations...
Retrieved 5 citations (threshold: 0.4)
載入 Embedding 模型: bge-m3...
正在檢索相關片段...
成功檢索到 5 個相關片段 (門檻: 0.4)
埋め込みモデルを読み込み中: bge-m3...
ユーザーのクエリに関連する引用を取得中...
5 件の関連引用を取得しました (しきい値: 0.4)