gem install transyncYou need settings file to be named transync.yml and to be in same directory from which we are running transync command.
For example see transync.SAMPLE.yml.
You'll need to create an API project for Google Drive. Good instructions are written
here.
Just copy and paste client_id and client_secret into transync.yml file.
You have xliff files in one directory (I suggest app/Resources/translations), named like: common.en.xliff where common
is name of the file and also GDoc spreadsheet tab. en is language and you have GDoc with structure where
first row is key, language 1, language 2, ...
Updating GDoc from our xliff files. It won't delete any key, it will only add new or change existing ones. Same for direction from GDoc to xliff.
- Create new Google Doc Spreadsheet
- Copy it's
keyfrom URL totransync.yml - Set all the languages and
xlifffiles (without language) you want to sync intransync.yml(look attransync.SAMPLE.yml) - set
XLIFF_FILES_PATHto set path where are yourxlifffiles. In project do it with relative path so others can use it - set
MISSING_TRANSLATION_TEXTto set what text should go totargetelement for translation - run these commands respectively
transync test # test if all keys are set for all the languages. Also tests if everything in sync with GDoc
transync update # will test and add all the missing keys that are not presented for a particular language in XLIFF files
transync init # will write all translations from XLIFF to GDoc spreadsheet. You need to run update command first, to ensure no keys are missing
# After init was made you have these two to sync modes between Gdoc and XLIFF
transync x2g
transync g2x
ruby g2x_spec.rb
ruby x2g_spec.rb
ruby update_spec.rb
- use ruby's 2.0 named parameters (more clear method calls)
- better tests (move out network dependency -> maybe try VCR, run all tests with RAKE)
- add to travis / code climate