daugsbi / simpleen-cli

A CLI-Tool to automatically translate your i18n project
https://simpleen.io
Other
3 stars 0 forks source link

How to implement glossaries in CLI? #7

Open scmcca opened 2 years ago

scmcca commented 2 years ago

I'd like to implement glossaries and "do not translate" lists when I translate with the CLI. The documentation is not very clear how to go about this. Is there a way to write it into simpleen.config.json? Thanks

daugsbi commented 2 years ago

You can use one glossary per language pair, which includes the glossaries and do not translate lists. Add/edit your glossary and see the corresponding ID in the overview.

The glossary ID(s) can be added individually per target language to the config simpleen.config.json:

{
  "source_language": "EN",
  "target_languages": ["FR", "DE", "JA"],
  // ...
  "glossary": {
    "FR": 90,
    "DE": 90,
    "JA": 89
  }
}

The config above takes the glossary with the ID 90 to translate from EN to FR (french) and from English to DE (german). It uses the glossary with the ID 89 for JA (Japanese).

You can find another example in the README.md.

stophecom commented 2 years ago

I finally had the time to use this service properly and I like the simplicity of it. One thing that confuses me is the "source of truth" / glossary approach.

Here is what I did: I used the CLI to translate a json simpleen translate, made some corrections, and uploaded it to simpleen simpleen upload. Now when I translate it again. I am confused because it will overwrite the already translated (and fixed) translations again. I would expect that it checks if a specific key exists remotely, before overwriting (re-translating) it.

Update 1 Ok now I am confused, I tried to find the actual file online. It's not really documented, but I guess these are the files https://simpleen.io/app/#/files When I look at the contents, I see that the translations don't include my corrections. So I guess the upload failed (CLI suggested a successful upload), or the files are somehow cached.

But maybe I misunderstood the workings and I should use the glossary instead. But this would be quite a drawback imo.

I'd be happy for help on this :)

Config looks like this

{
  "source_language": "EN",
  "target_languages": ["FR", "PL"],
  "interpolation": "default",
  "input_path": "./public/locales/en/*.json",
  "output_path": "./public/locales/$locale/$FILE.json",
  "auth_key": "foo"
}
scmcca commented 2 years ago

@daugsbi The glossary method above and in the documentation does not work for me with my "do not translate" glossary. Is an update from 0.6.3 needed?

daugsbi commented 2 years ago

@stophecom We fixed this last Friday. The upload was not properly working.

@scmcca : Did you translate them before without glossary? If that's the case, you need to delete the corresponding segments. Just search for words of your do not translate list in the simpleen segments and delete those. Then you can translate them again and see if it works.

scmcca commented 2 years ago

@daugsbi Is there a command I can use to delete all segments and start over? I have thousands of segments and the browser only seems to allow a maximum of 25 per page.

stophecom commented 2 years ago

@daugsbi Thank you!