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

Unsure about where translation files come from #55

Open
mikedloss opened this issue Mar 13, 2019 · 6 comments
Open

Unsure about where translation files come from #55

mikedloss opened this issue Mar 13, 2019 · 6 comments

Comments

@mikedloss
Copy link

mikedloss commented Mar 13, 2019

I'm trying to understand the fbt demo app a little better. I think I understand what most scripts are doing, but I don't understand where any of the ./translations/*.json files come from. They seem to be auto generated due to there being base64 strings as keys.

Are these json files auto generated? Or compiled by hand?

(to be clear - I'm not asking about the actual translated text, I'm asking about how these files get generated for me to fill in with my own translations for phrases 😊)

@mikedloss mikedloss changed the title Unsure about where translations come from Unsure about where translation files come from Mar 13, 2019
@jrwats
Copy link
Contributor

jrwats commented Mar 15, 2019

HI @mikedloss,

This is my fault for not yet adding an overview section in our docs explaining the high-level architecture of FBT. I'll message our engineers internally about adding some overview documentation.

These particular files were manually translated by our vendors and I did a query to fetch them from our internal DB. I then generated the JSON from the Object in the expected format which is described here:

https://facebookincubator.github.io/fbt/docs/translating

To get to the root of your question, those translation JSON files are not generated for "free".

image

The translation "cloud" and "Storage" in the above diagram are NOT provided by the FBT framework. And that magical dotted arrow going from the "storage" to the "translation dictionaries" are basically what calling the "translate" script on those JSON translations input represents.

CC @kayhadrin @w1106c

@mikedloss
Copy link
Author

Thanks @jrwats ! So from my understanding, we'd need to convert our translations over into a .json file that can be picked up and used by the "translate dictionaries" script, right?

@lesleyhogg
Copy link

@jrwats @kayhadrin @w1106c Any updates to adding the architecture overview documentation? Or any plans for additional documentation on how to add additional languages?

@AdamRamberg
Copy link
Contributor

AdamRamberg commented Aug 18, 2019

If anyone plans to just handle translations in the source code directly (not following @jrwats diagram above) I've created a script that take the output from collectFbts.js and generates translations like the ones in the translations folder or in the single file format. It can be found here.

You still need to translate the actual text yourself though... 😹

@koistya
Copy link

koistya commented Nov 10, 2019

I'm building a crowdsourced translation tool / manager that would allow you to have a similar workflow demonstrated above by @jrwats. You can check it out here -> https://helptranslate.com While it's in early preview, I'm willing to help you integrate it with FBT and set all the things up.

image

@lmarcon
Copy link

lmarcon commented Aug 1, 2020

If anyone plans to just handle translations in the source code directly (not following @jrwats diagram above) I've created a script that take the output from collectFbts.js and generates translations like the ones in the translations folder or in the single file format. It can be found here.

You still need to translate the actual text yourself though... 😹

This is great, thanks! It was a bit hard to figure out how to use the "locales" parameter, though. It would be nice to put an example of the locales.js that you mention in the README. To make it work, I created a src/i18n/locales.js with the following sample content:

module.exports = { en_US: {}, it_IT: {} }

Update: found more info in your blog post: https://medium.com/@adamramberg/translate-your-react-app-with-ease-using-facebooks-own-framework-fbt-e8f6af04d3d9 :)

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

No branches or pull requests

6 participants