Skip to content

Commit d275de1

Browse files
committed
fix: std i18n translator
1 parent f8ac776 commit d275de1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+14072
-13900
lines changed

crates/emmylua_ls/src/handlers/initialized/std_i18n.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ fn check_need_dump_std(resources_dir: &Path, locale: &str) -> bool {
118118
/// Params:
119119
/// - `locale` - 语言
120120
/// - `out_parent_dir` - 输出目录的父目录
121-
fn generate(locale: &str, out_parent_dir: &Path) -> (PathBuf, Vec<LuaFileInfo>) {
121+
fn generate(locale: &str, out_parent_dir: &Path) -> Vec<LuaFileInfo> {
122122
let origin_std_files = emmylua_code_analysis::load_resource_from_include_dir();
123123
let translate_std_root = out_parent_dir.join(format!("std-{locale}"));
124124
log::info!("Creating std-{locale} dir: {:?}", translate_std_root);
@@ -145,11 +145,7 @@ fn generate(locale: &str, out_parent_dir: &Path) -> (PathBuf, Vec<LuaFileInfo>)
145145
});
146146
}
147147

148-
// 写入版本文件,用于下次启动时判断是否需要重新生成
149-
let version_path = translate_std_root.join("version");
150-
let _ = std::fs::write(&version_path, VERSION);
151-
152-
(translate_std_root, out_files)
148+
out_files
153149
}
154150

155151
fn translate_one_std_file(locale: &str, rel_lua_path: &Path, content: &str) -> Option<String> {
@@ -385,14 +381,14 @@ mod tests {
385381
use super::generate;
386382

387383
#[test]
384+
#[ignore]
388385
fn test_generate_translated() {
389386
let test_output_dir = Path::new(env!("CARGO_MANIFEST_DIR"))
390387
.parent()
391388
.unwrap()
392389
.join("emmylua_code_analysis")
393390
.join("resources");
394-
let (root, files) = generate("zh_CN", &test_output_dir);
395-
assert!(root.exists());
391+
let files = generate("zh_CN", &test_output_dir);
396392
assert!(!files.is_empty());
397393
}
398394
}

0 commit comments

Comments
 (0)