TransM
Overview
TransM is a translation assistant tool for Markdown document files which keeps your translation maintainable.
It provides CLI to create a translation markdown file from an original markdown file. The translation file contains both original texts and translated texts as the following:
<!-- L1..1
# Title
-->
# タイトル
<!-- L3..4
* item1
* item2
-->
* 要素1
* 要素2The file has oritignal texts as HTML comments so they will be hidden on rendering. This approach enables to keep correspondence between original sentences and translated sentences in a single file. It’s usefull to check correctness of translation and maintain.
Installation
You need Deno before installing this tool.
Then, install TransM CLI.
$ deno install --allow-read --allow-write https://deno.land/x/transm/transm.tsGetting Started
Let’s start translation with a simple markdown text (example.md) as below:
# Title
* item1
* item2The command $ transm new creates a markdown file for translation from a target file.
$ transm new example.md translation.mdThe file translation.md generated by the command looks like:
<!-- L1..1
# Title
-->
# Title
<!-- L3..4
* item1
* item2
-->
* item1
* item2You can edit translation.md as you like except comment blocks, which represent texts and positions of the original file. Of cource you can use machine translation such as Google Translate or DeepL. Suppose the file will be edited as below:
<!-- L1..1
# Title
-->
# 表題
<!-- L3..4
* item1
* item2
-->
* 要素1
* 要素2OK. Translation has been done.
But, you might be curious about the case when the original file example.md changes. In that case, you can use the command $ transm update.
Suppose the example.md is edited as below:
* item1
* item2
+* item3The command $ transm update updates the translation file following the change of the original file.
$ transm update example.md translation.mdThe file translation.md will be updated as below. Notice that the second block is updated.
<!-- L1..1
# Title
-->
# 表題
<!-- L3..5
* item1
* item2
* item3
-->
* item1
* item2
* item3You can re-translate the updated text after the update command. In this way, TransM supports “continuous translation”.
Advanced Usage
How to process multiple files?
Use UNIX command together. Example:
$ ls target/ | xargs -I{} transm new target/{} translate/{}Development
Testing.
$ deno test test/Run in local.
$ ./bin/transm