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

support ?i18n_viz=keys and ?i18n_viz=values #664

Merged
merged 6 commits into from
Feb 1, 2025

Conversation

wbazant
Copy link
Collaborator

@wbazant wbazant commented Jan 14, 2025

Closes #662

@ezwelty
Copy link
Collaborator

ezwelty commented Jan 27, 2025

@wbazant Neat idea to bring over some of that functionality.

There seems to be issues with keys that accept parameters or that contain raw HTML. Their value (in the former) or their key (in the latter) is "[object Object]", and in the latter for some reason the dialogue and message are different on click.

Screenshot 2025-01-27 at 23 26 43 Screenshot 2025-01-27 at 23 28 10 Screenshot 2025-01-27 at 23 27 16

In terms of implementation, something that might help is that passing language 'cimode' to the i18next library exposes the key rather than the value (see https://www.i18next.com/overview/api#changelanguage). Unfortunately, in the current version of Phrase, it isn't possible to build a URL to the key in the translation editor from the locale and key (instead you need to know the internal Phrase id of the locale and key).

Finally, it's worth mentioning that Phrase provides adapters for an in-context editor: https://support.phrase.com/hc/en-us/articles/5784095916188-In-Context-Editor-Strings
We have a paid plan for the next year, but based on the pricing and my communication with them about the surprise payment, I'm not sure I want to invest too much in their platform (i.e. we may want to jump ship).

@wbazant
Copy link
Collaborator Author

wbazant commented Feb 1, 2025

Thanks, I thought it'll be handy when we start doing the translations.

accept parameters
Added a hack - the issue was with keys that accept other translations as keys. I've rendered them as "[1 day] ago" , where the value in squares is an example for that entry.

raw HTML
I did something different there because toast() doesn't work when stringified and re-parsed, but alert() of a simple string does. I also noticed that it needed fixing for i18n_viz=keys, because it showed up badly.

I'm with you on not potentially staying with Phrase - I was thinking to implement a process with Google Sheets as UI, where a script produces a spreadsheet, we upload it, and then merge and review changes. It won't have Phrase features that people working with professional translators want, but it could be easier to contribute to: instead of a "let me add you to Phrase" step, anyone can just start. Also, no tempting 'AI translate' button from Phrase.

@wbazant wbazant merged commit ee55d6d into falling-fruit:main Feb 1, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add tool for translators showing translation keys
2 participants