question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Documentation on how to extract and load translations?

See original GitHub issue

Hey! We have a react application that we need to translate and are evaluating using 18next vs react-intl for this. I’m having a problem finding the documentation necessary to evaluate it and hoping you can help me!

We use the service transifex (https://www.transifex.com/) for all of our translations (Native apps, backend servers, etc) and want to continue using that on this react app. What they need from us is translations extracted from our .js files and uploaded to them, they support many formats but we use gettext everywhere else ( https://docs.transifex.com/formats/gettext ).

So my question:

  • How can I extract translations into a static .json or .po file that can be sent to a translation service?
  • How can I use webpack to load the translated files for i18next to read?

I see a lot of the community is using xhr backend but we will not be doing this, we will be using webpack + code-splitting to make sure we only need to bundle the languages the user needs.

I did search the internet/docs before opening this issue and found this blog post which talks about exactly what I need:

https://medium.com/@jamuhl/i18n-frameworks-the-unfair-showdown-8d436cd6f470

Round 5: How to extract translations from your code

but the link is dead.

Ideally I could use babel/webpack to extract all the strings.

Thanks for your help!

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
jamuhlcommented, Nov 14, 2017

For react and i18next have a look at react-i18next (comes with endless samples): https://github.com/i18next/react-i18next

Regarding tooling: You will find both extraction tools and bundlers/loaders for webpack here: https://www.i18next.com/plugins-and-utils.html#utils

there is also a gettext converter -> if you like to stay on gettext for transfer (on top of the utils list)

regarding transifex, not want to make advertising, but i18next has a own translation management / localization as a service tier: https://locize.com

comes with a lot of benefits and is less expensive 😉 -> see the example in the react-i18next repo https://github.com/i18next/react-i18next/tree/master/example/locize-example —> movie that says more than words https://www.youtube.com/watch?v=9NOzJhgmyQE

Both supported react-intl’s icu format and i18next (so no thinking about converting plurals) -> really worth a try (we got a lot customers switching over from transifex)

0reactions
jamuhlcommented, Dec 26, 2019

@norayr93 beside i18next-parser, i18next-scanner there is now also babel-plugin-i18next-extract https://www.i18next.com/overview/plugins-and-utils#extraction-tools

still, the most comfortable way is using the saveMissing with https://locize.com during development time.

This also gives you a proper solution at hand to involve your translators into the process 👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

Extracting translations - i18next documentation
Static extraction tools can read through your code files to automatically find and export translation keys. i18next-scanner, i18next-parser and ...
Read more >
What is ETL (Extract, Transform, Load)? - IBM
ETL is a process that extracts, transforms, and loads data from multiple sources to a data warehouse or other unified data repository.
Read more >
Introduction — Translation Proxy Documentation latest ...
A translation proxy is a layer placed between the browser and the original website, through which the visitor sees the original website in...
Read more >
Documentation - Extract hardcoded strings from Vue templates
Press Alt+Enter (called “Show Context Actions” in Preferences → Keymap); Select extraction. Select where to extract, if having a multiple translation files ...
Read more >
Babel Documentation - Read the Docs
For these requirements, Babel includes data extracted from the Common Locale Data ... translations.merge(Translations.load('plugin1')).
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found