Skip to content

AnyaTyu/md2xliff

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

md2xliff

Markdown to XLIFF and XLIFF to markdown converter.

Idea behind it is described at XML in Localisation: Use XLIFF to Translate Documents article.

Package provides extract module which parses markdown files and generates XLIFF and skeleton.

Translater fills XLIFF with translations. pretranslate module may be used for automatic translation with the help of Yandex Translator API.

Online XLIFF Editor may be used to work with XLIFF files.

Then with reconstruct module it is possible to build translated markdown with the same markup as in source document.

Usage

All modules have JS API and a CLI.

extract

To extract XLIFF and generate skeleton run ./bin/extract test/source.md.

reconstruct

To reconstruct new markdown from XLIFF and skeleton built with extract command run ./bin/reconstruct test/source.xlf test/source.skl.md target.md.

Environment variable USE_SOURCE may also be used to reconstruct target markdown from <source> units of XLIFF. It is helpful for testing: USE_SOURCE=1 ./bin/reconstruct test/source.xlf test/source.skl.md target.md.

pretranslate

To automatically pretranslate XLIFF run API_KEY=your-yandex-translator-api-key ./bin/pretranslate test/source.xlf.

It is also possible to set JUST_UPPER_CASE environment variable to use upper case of source units instead of translation which may be useful for testing: JUST_UPPER_CASE=1 ./bin/pretranslate test/source.xlf.

About

Markdown to XLIFF converter

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%