nosgestesclimat-site icon indicating copy to clipboard operation
nosgestesclimat-site copied to clipboard

Comment puis-je traduire le site en portugais et en anglais ?

Open micaelbatista opened this issue 2 years ago • 4 comments

Hi,

I'm from a portuguese non-profit organization, and I'd like to translate your site to portuguese and english (if I have enough time). However, I'm having some trouble to find out how can I do it. It looks like the text is embedded in the source code, but I'm not sure since I never coded in React. How can I go around translating this site?

Best regards


Salut,

Je fais partie d'une organisation à but non lucratif portugaise et j'aimerais traduire votre site en portugais et en anglais (si j'ai assez de temps). Cependant, j'ai du mal à savoir comment faire. On dirait que le texte est intégré dans le code source, mais je n'en suis pas sûr puisque je n'ai jamais codé en React. Comment puis-je faire pour traduire ce site ?

Cordialement

micaelbatista avatar Jul 10 '22 21:07 micaelbatista

I just found the task #470 in your kanban, where you say that you're thinking of using deepl to translate your site. If this is the route you intend to follow, how can I help?


Je viens de trouver la tâche #470 dans votre kanban, où vous dites que vous envisagez d'utiliser deepl pour traduire votre site. Si c'est l'itinéraire que vous avez l'intention de suivre, comment puis-je vous aider ?

micaelbatista avatar Jul 10 '22 21:07 micaelbatista

Hi, yes, that's right, you found it. We're aiming at a translation platform for around september :) After the first automatic deepl pass, you'd have a translation file where you could make the texts better. We'll keep you posted :)

laem avatar Jul 11 '22 12:07 laem

I keep this issue open for further work when we're ready :)

laem avatar Jul 11 '22 12:07 laem

Hi Mael,

I talked through the email with Benjamin Boisserie and Martin Régner about this as well, but I'll say it in here as well. We are interested in having access to the NGC tool so we can use it in our association launch in October. If there's anything we (me and our team here in Portugal) can help to make the translation happen until then, please let me know!

Best regards,

micaelbatista avatar Aug 06 '22 10:08 micaelbatista

Hi all,

It seems the translation, for english at least, is almost finished, based on your website and this task #470 . Although the website says the translation is still in beta.

With this, since we are interested in using this tool in our website, can we validate the english translation, or translate to portuguese as well? Do you already have the translation files separated for us to do this?

Best regards and happy new year!

micaelbatista avatar Jan 05 '23 09:01 micaelbatista

Hi @micaelbatista, happy new year :)

It seems the translation, for english at least, is almost finished, based on your website and this task #470 . Although the website says the translation is still in beta.

Indeed, we have a pushed online an English version of the UI. We had several reviewed by native speakers and keep improving it -- see #723. However, the current workflow for the automatic translation isn't great and needs improvement -- see this comment.

With this, since we are interested in using this tool in our website, can we validate the english translation, or translate to portuguese as well? Do you already have the translation files separated for us to do this?

Problems of translation management mainly occur when willing to edit an existing translation files. So, if it should be straightforward to add a new language. You can start by reading the related wiki page and looking to this PRs which add a first version of the Spanish and Italian translation -- #769 and https://github.com/datagir/nosgestesclimat/pull/1621.

Don't hesitate to ping me if you have any question about it.

During your journey to add a translation for a new language, it could be great if you can write down any difficulty or suggestion to improve the workflow and the ergonomics.

EmileRolley avatar Jan 05 '23 11:01 EmileRolley

Hi @EmileRolley , happy new year 🥳

Thanks for all the work! And I indeed have a couple questions after reviewing your answer:

  1. In the last step of the wiki in the Adding a new language section, you tell us to: > runs all needed scripts as described in the Updating the translation section. What do I need to run those scripts?
  2. In the PR #1621 you also updated the files data/translated-rules-*.yml, although they are not mentioned in the wiki. Do we need to translate that file as well besides the source/locales/ui, source/locales/faq, source/locales/releases, e sites/publicodes/pages/*?
  3. Do you recommend using any assisted translation software, or do you just edit the yaml and json files directly, or maybe with just an helper excel or something?

Also, I have a couple questions regarding the iframe, since that's the solution we were thinking of using. I did a couple tests using this codepen, but I still have some questions about this solution:

  1. Regarding the iframe integration you mention here, is there anyway to set a default language (for instance EN-US instead of FR)?
  2. Is there anyway to make the iframe start already in the test itself?

micaelbatista avatar Jan 06 '23 20:01 micaelbatista

What do I need to run those scripts?

Once the new language added in the project as described in the Adding a new language section, you'll need to translate the UI content in this new language and therefore using the dedicated scripts to generate the translation files.

  1. In the PR #1621 you also updated the files data/translated-rules-*.yml, although they are not mentioned in the wiki. Do we need to translate that file as well besides the source/locales/ui, source/locales/faq, source/locales/releases, e sites/publicodes/pages/*?

Yes indeed, the data/translated-rules-<lang>.yaml contain the translation of the questions and descriptions of the test which are stored in the nosgestesclimat model repository. You can generate those running the yarn run translate:rules -t <lang> and yarn run translate:personas -t <lang> after adding the new supported language abbreviation in https://github.com/datagir/nosgestesclimat/blob/master/scripts/i18n/utils.js#L9. (I need to update the wiki).

  1. Do you recommend using any assisted translation software, or do you just edit the yaml and json files directly, or maybe with just an helper excel or something?

Translation scripts of both the model and the website repository are built on top of the DeepL API -- see the dedicated section. It's for this reason you need to run all needed scripts as described in the Updating the translation section.

The basic workflow is to automatically generate the translation files by using the dedicated scripts wrapped around the DeepL API then, to review and to correct them by hand if needed.

Note that as I mentioned in my previous comment, the translation workflow isn't great for now, and I'll be working on improving it the next months. If you had any suggestion or features don't hesitate to write them in #783.

Also, I have a couple questions regarding the iframe, since that's the solution we were thinking of using. I did a couple tests using this codepen, but I still have some questions about this solution:

  1. Regarding the iframe integration you mention here, is there anyway to set a default language (for instance EN-US instead of FR)?
  2. Is there anyway to make the iframe start already in the test itself?

I will let @laem answer to your questions related to the iframe :)

EmileRolley avatar Jan 09 '23 10:01 EmileRolley

Hi @laem!

Did you have the time to look into these questions, or do you need any additional information? 🙂

Best regards, Micael Batista

micaelbatista avatar Jan 16 '23 18:01 micaelbatista

Hi @EmileRolley ,

So, I started to add the pt lang to a fork I created from this repo, but I got an error trying to generate the translation files. Could you tell me what I should do to overcome this?

Here is the commit I made with everything I could do: https://github.com/micaelbatista/nosgestesclimat-site/commit/7cd30664683c7290461ec4d6c275931926ca392e

And here are the steps I followed:

  1. Forked your repo
  2. Made changes to ./source/locales/translation.ts to include the pt lang
  3. Duplicated the folder ./source/locales/pages/fr to ./source/locales/pages/pt
  4. Installed node v18.14.0, npm v9.3.1, and yarn v1.22.19
  5. Ran yarn install
  6. Created a DeepL Authorization Key
  7. Ran DEEPL_API_KEY=<authkey> yarn translate:ui pt in the ./scripts/i18n folder

And then it gave this back to me:

/mnt/d/git/nosgestesclimat-site/scripts/i18n$ DEEPL_API_KEY=<authkey> yarn translate:ui pt
yarn run v1.22.19
warning ../package.json: No license field
$ node scripts/i18n/translate-ui.js pt
node:internal/modules/cjs/loader:1050
  throw err;
  ^

Error: Cannot find module './../../nosgestesclimat/scripts/i18n/utils'
Require stack:
- /mnt/d/git/nosgestesclimat-site/scripts/i18n/paths.js
- /mnt/d/git/nosgestesclimat-site/scripts/i18n/translate-ui.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1047:15)
    at Module._load (node:internal/modules/cjs/loader:893:27)
    at Module.require (node:internal/modules/cjs/loader:1113:19)
    at require (node:internal/modules/cjs/helpers:103:18)
    at Object.<anonymous> (/mnt/d/git/nosgestesclimat-site/scripts/i18n/paths.js:7:15)
    at Module._compile (node:internal/modules/cjs/loader:1226:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1280:10)
    at Module.load (node:internal/modules/cjs/loader:1089:32)
    at Module._load (node:internal/modules/cjs/loader:930:12)
    at Module.require (node:internal/modules/cjs/loader:1113:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/mnt/d/git/nosgestesclimat-site/scripts/i18n/paths.js',
    '/mnt/d/git/nosgestesclimat-site/scripts/i18n/translate-ui.js'
  ]
}

Node.js v18.14.0
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Q1. What should I do to generate all the files to start translating to the pt lang?

Also, I noticed that in the english translation there's a duplication of text with the "lock" word

Q2. Do we also need to do duplicate the lines with and without lock for the pt lang version?

Here is an example from the ui-en-us.yaml file

And here is an example from the FAQ-en-us.yaml file

micaelbatista avatar Feb 15 '23 20:02 micaelbatista

Hey,

So, I was able to solve the first issue I had, basically I didn't git clone recursively.

The 2nd issue, after looking into the nos gestes climat repo, seems like it's something you use in your code, so I'll just duplicate the lines for every entry I translate.

micaelbatista avatar Feb 17 '23 19:02 micaelbatista

Hi @micaelbatista,

I'm glad you succeed to solve the first issue!

Regarding your second question, the .lock attributes are automatically generated and are used to track changes in the source code. Consequently, you shouldn't edit them by hand.

Before going deeper, you should be aware that we are currently focusing to improve our translation workflow, see https://github.com/datagir/nosgestesclimat-site/issues/782 and the work done by @Clemog in https://github.com/datagir/nosgestesclimat/pull/1676.

EmileRolley avatar Feb 18 '23 11:02 EmileRolley

Thanks for the warning! But if I translate the files, even if the workflow changes, the translations I do can be used correct? Even if I have to wrangle the files in some way.

micaelbatista avatar Feb 20 '23 07:02 micaelbatista