I18n
Lightweight i18n solution for universal JavaScript apps and modules.
Install / Use
/learn @Draggable/I18nREADME
i18n 
Add multi-lingual support to any JavaScript app or module with this light-weight package.
Features:
- Isomorphic/Universal
- easy translation of static text files
- benefits: anyone can translate, no more xliff
- reduced margin of error.
- Variable support
- Dependency free
- Fast
Usage
import { I18n } from '@draggable/i18n'
const i18nOptions = {
extension: '.lang', // extnsion used by your language files, defaults to ".lang"
location: 'https://location.of/language/files/', // absolute or relative url to language files
langs: [
// locales you would like to be active
'en-US',
'pt-BR',
'de-DE', // will attempt to load `https://location.of/language/files/de-DE.lang` with current config
],
locale: 'en-US', // default locale
override: {
'en-US': {
autocomplete: 'Autofinish', // override individual keys or provide entire language definition
},
},
}
const i18n = new I18n(i18nOptions)
... then in your app
<label>{i18n.get('addOption')}</label>
Add a Language after initialization
i18n.addLanguage('fr-FR', {
addOption: 'Ajouter une option',
})
Process a confige file
i18n.processConfig(configFileString)
Example .lang file
de-DE = Deutsch
en-US = German
addOption = Option hinzufügen
allFieldsRemoved = Alle Felder wurden entfernt.
allowMultipleFiles = Upload mehrerer Dateien erlauben
autocomplete = Autovervollständigung
Related Skills
node-connect
344.4kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
99.2kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
344.4kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
344.4kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
