From 84d2344747862b7cc6c19040fc21c881a974e741 Mon Sep 17 00:00:00 2001 From: filesite Date: Mon, 16 Jun 2025 16:34:28 +0800 Subject: [PATCH] Readme of i18n update --- i18n/README.md | 25 ++++++++++++++++++++++--- public/template/index.html | 2 +- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/i18n/README.md b/i18n/README.md index 747c3a1..89409aa 100644 --- a/i18n/README.md +++ b/i18n/README.md @@ -22,11 +22,30 @@ * zh-sg - 新加坡繁体中文 -## 翻译命令 +所有语言代码均为小写字母。 + + + +## 语言包命令 + + +### 从模板文件解析默认语言包 ``` -node translate.mjs [语言代号] +node i18n.mjs init [默认语言代号] ``` -如果不传参数“语言代号”,则翻译i18n/目录下的所有以配置的语言。 +如果不传参数“默认语言代号”,默认从模板文件的标签中解析,如果解析失败,则默认为英文en; +从template/里的模板文件中解析出语言模版代码,并保存到i18n/{默认语言代码}.json文件中。 + + + +### 使用语言包生成html文件 + +``` +node i18n.mjs build [语言代号] +``` + +如果不传参数“语言代号”,则生成i18n/目录下的所有已配置语言对应的html文件。 + diff --git a/public/template/index.html b/public/template/index.html index 390fe1e..50956e8 100644 --- a/public/template/index.html +++ b/public/template/index.html @@ -1,5 +1,5 @@ - +