diff options
| author | 魏曹先生 <1992414357@qq.com> | 2025-10-14 17:17:48 +0800 |
|---|---|---|
| committer | 魏曹先生 <1992414357@qq.com> | 2025-10-14 17:17:48 +0800 |
| commit | 0cd19e64d4d255e45233255478ca3a0bd5c439ae (patch) | |
| tree | 6bfa39c10731328edacc6b1c86ae49c85197f7ed /src/utils/lang_selector.rs | |
| parent | 24c2c8cad43c755cf668ea92a08c0be7fb3b819d (diff) | |
feat: add internationalization support and new command-line tools
- Add locale support with English and Chinese translations
- Introduce new jv and jvv command-line tools
- Replace jvc.rs with improved command structure
- Add utility modules for language selection and markdown coloring
- Update configuration and dependencies
Diffstat (limited to 'src/utils/lang_selector.rs')
| -rw-r--r-- | src/utils/lang_selector.rs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/utils/lang_selector.rs b/src/utils/lang_selector.rs new file mode 100644 index 0000000..c3603ea --- /dev/null +++ b/src/utils/lang_selector.rs @@ -0,0 +1,14 @@ +pub fn current_locales() -> String { + if let Ok(lang) = std::env::var("APP_LANG") { + return lang; + } + + if let Ok(lang) = std::env::var("LANG") { + if let Some(base_lang) = lang.split('.').next() { + return base_lang.replace('_', "-"); + } + return lang; + } + + "en".to_string() +} |
