Open-Assistant icon indicating copy to clipboard operation
Open-Assistant copied to clipboard

Write a script to sync translation in EN with other locales

Open notmd opened this issue 1 year ago • 11 comments

The script should accept an option locales params, example signature in TS

type Params = {
  locales?: string[]
}

notmd avatar May 07 '23 16:05 notmd

or it would be great if anyone can setup a free i18n management service, thing like https://localazy.com

notmd avatar May 07 '23 16:05 notmd

Yeah, I would also prefer a TMS like pontoon or weblate. I never tried localazy, but it looks fine too. A script would be a great tool in the meantime, though. It's hard to find all missing strings just by comparing the JSONs.

stefangrotz avatar May 07 '23 19:05 stefangrotz

Does this not already exist?

https://github.com/LAION-AI/Open-Assistant/blob/main/scripts/frontend-development/find-missing-locales.py

olliestanley avatar May 07 '23 20:05 olliestanley

Does this not already exist?

https://github.com/LAION-AI/Open-Assistant/blob/main/scripts/frontend-development/find-missing-locales.py

It only allows to find untranslated words, not sync with the EN to remove staled words (words that in the other locales but get deleted in EN). We can extend to support this behavior

notmd avatar May 07 '23 20:05 notmd

I would like to set up inlang for Open-Assistant by just adding an inlang.config.js. This would give contributors and translators the ability to edit translations in a frontend and make pull requests to Open-Assistant without overhead for maintainers. It comes with default lint rules that mark missing translations or outdated references.

Here is a preview, with a sample project: https://inlang.com/editor/github.com/inlang/example

In addition, other useful tools are supported to make i18n easier like a VS Code plugin (in the next days) and a CLI.

Let me know and I'll set it up for you 🙂

NiklasBuchfink avatar May 09 '23 16:05 NiklasBuchfink

@NiklasBuchfink does it compatible with next-i18next?

notmd avatar May 09 '23 16:05 notmd

@notmd Yes, I have already set it up several times with i18n-next and there will be a custom integration for i18n-next in the future, as mentioned 👍

NiklasBuchfink avatar May 09 '23 17:05 NiklasBuchfink

@notmd I'm currently building a i18n-next plugin with inlang that users from i18n-next can use the inlang IDE extension to massively speed up their workflow and use the git-based online editor. 🎉 see https://inlang.com for more

felixhaeberle avatar May 09 '23 17:05 felixhaeberle

@notmd Yes, I have already set it up several times with i18n-next and there will be a custom integration for i18n-next in the future, as mentioned 👍

Then please help us setup, thank you!

notmd avatar May 09 '23 17:05 notmd

Looks very simple, just create a json file that defines the reference language: https://inlang.com/documentation/getting-started

After that it should be able to use it with this URL https://inlang.com/editor/github.com/LAION-AI/Open-Assistant/

Only the i18n-next plugin plugin is missing rn, right?

stefangrotz avatar May 10 '23 08:05 stefangrotz

@stefangrotz That's right, the i18n-next plugin is currently under development. But there is also a json plugin that works for this use case. I still need to extend it a bit to support the {language}/*.json folder structure. I`m working on that right now.

NiklasBuchfink avatar May 10 '23 09:05 NiklasBuchfink

@notmd @stefangrotz It took a little longer, but the time was used to optimize everything for a project like Open-Assistant.

Now I have created the PR. Please let me know if I should change something.

NiklasBuchfink avatar Jun 12 '23 17:06 NiklasBuchfink