TransM
TransM is a translation assistant tool for Markdown document which keeps your translation maintainable.
Installation
You need Deno before installing this tool.
Then, install TransM CLI.
$ deno install --allow-read --allow-write https://deno.land/x/transm/transm.ts
Getting Started
Let's start translation with a simple markdown text (example.md
) as below:
# Title
* item1
* item2
The command $ transm new
creates a markdown file for translation from a target file.
$ transm new example.md translation.md
The file translation.md
generated by the command looks like:
<!-- L1..1
# Title
-->
# Title
<!-- L3..4
* item1
* item2
-->
* item1
* item2
You 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
* θ¦η΄ 2
OK. 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
+* item3
The command $ transm update
updates the translation file following the change of the original file.
$ transm update example.md translation.md
The 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
* item3
You 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