mirego / accent

The first developer-oriented translation tool. True asynchronous flow between translators and your team.
https://www.accent.reviews
BSD 3-Clause "New" or "Revised" License
1.31k stars 100 forks source link

Documentation is lacking and I have a hard time figuring out how to use Accent #125

Closed ro-kue closed 5 years ago

ro-kue commented 5 years ago

Hi!

I tried accent with a Vue frontend using vue-i18n with English as the master language and German as a translation.

The first thing I tried was very naive. I assumed you have a json file for every language and tried to make accent read and write the same file.

{
    "language": "en",
    "format": "json",
    "source": "src/locales/en.json",
    "target": "src/locales/en.json"
},
{
    "language": "de",
    "format": "json",
    "source": "src/locales/de.json",
    "target": "src/locales/de.json"
}

I have 6 translation ids right now and this made me translate 12 strings per language. Obviously wrong and since there's a source and a target parameter, not surprising. Then I tried having one file with empty strings for every id and use that as a source with different targets

{
    "language": "en",
    "format": "json",
    "source": "src/transkeys.json",
    "target": "src/locales/en.json"
},
{
    "language": "de",
    "format": "json",
    "source": "src/transkeys.json",
    "target": "src/locales/de.json"
}

Now I had 6 strings for every language. Great! But the documentation uses a glob. But how does it merge files? So I tried this

{
    "language": "en",
    "format": "json",
    "source": "src/trans/*.json",
    "target": "src/locales/en.json"
},
{
    "language": "de",
    "format": "json",
    "source": "src/trans/*.json",
    "target": "src/locales/de.json"
}

And I had 2 json files in trans with 2 keys each. That worked as well! 4 string per language. But then when I synced and exported, I only got 2 keys in de.json and en.json. My assumption: It doesn't merge the files and it's more for translation systems that have multiple files. Makes sense since I feel like this is more popular in large projects.

So back to my second attempt with one source file and multiple target files. I translated every string, exported and had the same German strings in both en.json and de.json.

I have no idea why and the documentation doesn't really tell me why either. Neither does the CLI nor does the documentation of the CLI. I have no idea how to use accent at all and everything that makes sense to me based on reading the documentation was a failure.

I'd really like to use Accent especially because I can't justify running something as hungry as weblate (which I know from work) and I love the CLI that comes with it. But I have no idea how to do that and I feel like the documentation shouldn't leave me hanging this early when trying out Accent.

simonprev commented 5 years ago

Hi! Thanks for you interest in Accent!

Yeah I have 3 different person this week that reported the same problem with the CLI. I will need to update the doc or make the configuration file less error prone.

In short, the "files" section represent a scope of translations. So for an fake project with 3 languages and a repo that looks like this:

app/locales/fr/admin.json
app/locales/en/admin.json
app/locales/jp/admin.json

The files section would only contain one "file" path: admin. The "sync" command along with the --write will write the to the file system for the master language. The -add-translations flag will merge translations for the "slave" translations (and will write to the file system with the same --write flag).

Also thanks for introducing a new translating tool to me (weblate), I’m always interested in "inspiring me" of some of the features of other products 😄

ro-kue commented 5 years ago

Hi!

Sorry for the late reply I was kinda busy.

Thanks for your reply. I'm still not entirely sure what to do. For this fake project, should my config look like this?

{
    "language": "fr",
    "format": "json",
    "source": "app/locales/fr/admin.json",
    "target": "app/locales/fr/admin.json"
},
{
    "language": "en",
    "format": "json",
    "source": "app/locales/en/admin.json",
    "target": "app/locales/en/admin.json"
},
{
    "language": "jp",
    "format": "json",
    "source": "app/locales/jp/admin.json",
    "target": "app/locales/jp/admin.json"
},

And then I'd have one file in accent called "admin" and everything works?

Weblate is a beast with something like 2gb minimum RAM requirement. That's why I was looking for an alternative and found Accent. Really excited to try it out once this is clarified (I'd have to change a good amount of stuff in my file structure to get this to work. Not a lot of work but I'd like to avoid that if I still have to do translations by hand).