Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Write a script to sync translation in EN with other locales #3077

Closed
notmd opened this issue May 7, 2023 · 12 comments · Fixed by #3393
Closed

Write a script to sync translation in EN with other locales #3077

notmd opened this issue May 7, 2023 · 12 comments · Fixed by #3393
Labels
good first issue Good issue for project newcomers i18n website

Comments

@notmd
Copy link
Collaborator

notmd commented May 7, 2023

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

type Params = {
  locales?: string[]
}
@notmd notmd changed the title Write a script to sync translation in en with other locale Write a script to sync translation in EN with other locales May 7, 2023
@notmd
Copy link
Collaborator Author

notmd commented May 7, 2023

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

@notmd notmd added the good first issue Good issue for project newcomers label May 7, 2023
@stefangrotz
Copy link
Contributor

stefangrotz commented May 7, 2023

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.

@olliestanley
Copy link
Collaborator

Does this not already exist?

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

@notmd
Copy link
Collaborator Author

notmd commented May 7, 2023

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

@NiklasBuchfink
Copy link
Contributor

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 🙂

@notmd
Copy link
Collaborator Author

notmd commented May 9, 2023

@NiklasBuchfink does it compatible with next-i18next?

@NiklasBuchfink
Copy link
Contributor

NiklasBuchfink commented May 9, 2023

@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 👍

@felixhaeberle
Copy link

felixhaeberle commented May 9, 2023

@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

@notmd
Copy link
Collaborator Author

notmd commented May 9, 2023

@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!

@stefangrotz
Copy link
Contributor

stefangrotz commented May 10, 2023

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?

@NiklasBuchfink
Copy link
Contributor

@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
Copy link
Contributor

@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.

@notmd notmd linked a pull request Jun 13, 2023 that will close this issue
olliestanley pushed a commit that referenced this issue Jun 13, 2023
## Description

This PR add the `inlang.config.js` and `@inlang/cli` to Open-Assistant
to solve the issue #3077

With these changes, translators can manage translations in a no-code web
editor and useful linting rules and machine translations can be used
within the editor or via the `@inlang/cli`.

I added a badge with the current translation status and a short
description to the contribution guidelines.

### Preview

**Editor**
A live instance of the editor can be previewed with the following link:
https://inlang.com/editor/github.com/NiklasBuchfink/Open-Assistant

**Badge**
[![translation
badge](https://inlang.com/badge?url=github.com/NiklasBuchfink/Open-Assistant)](https://inlang.com/editor/github.com/NiklasBuchfink/Open-Assistant?ref=badge)

## Further information

To check the status of the translations, exece `npx inlang lint`. Other
useful command like `machine translate` and `open editor` your can find
in the [docs](https://inlang.com/documentation/apps/inlang-cli).

Within this week, the inlang VS code extension should also work ootb for
`i18next` projects and helps extract messages and display inline
annotations.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good issue for project newcomers i18n website
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants