Translation - YiJingFramework/YiJingFramework.References.Zhouyi GitHub Wiki
在实例化 Zhouyi
类时,需要提供一份“翻译文件”。
你可以传入以 UTF-8 编码的翻译文件的路径或者流。如:
Zhouyi zhouyi = new Zhouyi("my_translation_file.json");
Stream translationFileStream; // = ...
Zhouyi zhouyi2 = new Zhouyi(translationFileStream);
由具有不同翻译文件的 Zhouyi
类提供的卦,其属性会有所不同。但是两个卦进行比较时,会忽略这些内容,只判断是否是代表相同的卦。
通过自定义翻译文件,您可以轻松地修改卦爻辞以及卦名,甚至可以用您的语言提供全文的翻译。
翻译文件只会在构造函数中使用,在 Zhouyi
类初始化完毕后它可以立即被释放,而这个 Zhouyi
类的实例应该被保存并复用,否则若要重复读取翻译文件会花费很多时间。
A translation file should be given when initializing an instance of Zhouyi
.
You can pass the translation file's path or a stream, in UTF-8. For example:
Zhouyi zhouyi = new Zhouyi("my_translation_file.json");
Stream translationFileStream; // = ...
Zhouyi zhouyi2 = new Zhouyi(translationFileStream);
Properties of the hexagrams and trigrams provided by Zhouyi
with different translations will have different values. But the same hexagrams and trigrams will still be compared equal, regardless of these translation-based properties.
By customizing the translation file, you can easily modify the texts or names as you like, or even provide a full translation in your language.
The translation file will only be used in the constructor, so it can be immediately disposed after initializing Zhouyi
, and the instance of Zhouyi
should be saved and reused since repeatedly reading a translation could be a cost of time.
这里可以下载到翻译文件。
如果您能够提供或者修正翻译,我们将不胜感激。您可以在 Issues 联系我们或创建pull requests 以提供翻译。
在翻译文件打包器的压缩文件中提供了一份中文翻译,你可以编辑它来制作你的翻译。文件接受注释和多余尾逗号。
Here can the translation files be downloaded.
We will appreciate it if you can help provide and correct the translations. Feel free to contact us in Issues or new pull requests for the translations.
A chinese translation is attached in the zip file of the translation file packer, you can just edit it to make your own translation. Comments and trailing commas are accepted.
翻译文件打包器可以在 Releases 中找到。它会移除注释和无用字符,尽可能压缩翻译文件,同时检查是否有缺失项目或者语法错误。
打包器基于 .NET 6 构建(曾经是 .NET 5 )。因此它几乎支持所有操作系统,但必须提前安装其运行时。
使用打包器,用在命令行 shell 中输入 dotnet TranslationFilePacker.dll <InputFile> <OutputFile>
。比如 dotnet TranslationFilePacker.dll mytranslation.json out.json
将会打包当前目录的 mytranslation.json
并写入 out.json
。
同时,要确保您使用的打包器符合你要使用的 YiJingFramework.References.Zhouyi
包的版本。
如果您是翻译者,您可以使用打包器来检查内容,但发布未打包的版本,这样你就可以留下一些相关的注释。作为包的使用者,您可以使用打包器打包翻译文件,在检查其可用性的同时使翻译文件的读取更加节省时间和空间,尽管这实际上不会产生太大影响。
The translation file packer, which can be found in the Releases, may help minimize the translation file by removing the comments and useless characters, as well as check whether there are missing items or other syntax mistakes in the translation file.
The packer is built against .NET 6 (used to be .NET 5), which means that it almost support every system, but you have to install its runtime first.
To use the packer, just enter dotnet TranslationFilePacker.dll <InputFile> <OutputFile>
in a command-line shell. For example, dotnet TranslationFilePacker.dll mytranslation.json out.json
will try packing the mytranslation.json
in this current directory and write into out.json
.
And make sure that the packer you are using meets the version of the YiJingFramework.References.Zhouyi
package.
As a translator, you might use the packer just to check the contents and publish the unminimized version so that you can leave some related comments. As a package user, you might then use the packer to pack the translation file, both to check its usability and to make the translation reading process become more time saving and space saving, although it won't actually affect a lot.