jmoenig / Snap

a visual programming language inspired by Scratch
http://snap.berkeley.edu
GNU Affero General Public License v3.0
1.49k stars 743 forks source link

Updating translation strings in lang files from code #1551

Open jguille2 opened 7 years ago

jguille2 commented 7 years ago

I see lang-de.js is not synchronized with code strings.

I can use lang-pt.js like a template (with 248 extra strings) to achieve a better translation... but I know it is not the right way.

I can try working with this to bring something useful. First thoughts:

In any case, I offer to work on this topic and follow your indications.

Joan

DyslexicAwe commented 7 years ago

@jguille2 Wow, that would be an awesome Seasons Holiday gift for all translators. Until now, changing an existing lang-LL.js was not an easy task and sometimes it just didn't work and I had no clue why it didn't work.

jguille2 commented 7 years ago

First of all, I try to develop a proposal and wait for your feedback... then I can do the job according to your instructions.

Excuse my non-first-class English language :(. Luckily, this is an asynchronous issue (I can use more time to do my best)... and I trust your patience to fix this (my) poor bug :))

Goals

Two main goals for our translation system:

Proposals

  1. Build a lang-en.js as the master template. English to English translation

    • All developers and helpers could directly update it, with the code changes.
    • Easier to spread changes. Partial translations will be copies from this template (with all the strings) that can be easily updated (only editing text).
    • English language could be refined without code changes (English code to English lang). This will not be the standard way, but an easy possibility. Some times, our free translations are more refined than the English one (chained to the system).
  2. lang-en.js (and the other lang files) can have all the strings in alphabetical order.

    • I like a thematic distribution (menu, blocks...) but strings can live in different scenarios.
    • Easier to developers to use existing strings, avoid collisions...
    • Maybe one line per string is better (although they'll be longer)
    • We can comment lines to add info. Source file, function... or only a counter of uses (to help developers to delete lang strigs after code modifications).
  3. Make an updater script to run it locally.

    • The script creates all new lang-xx.js files, copying from lang-en.js source and updating values from last lang-xx.js.
    • Then, each lang-xx.js file will have all the strings updated. New strings with their English value, and the others with their own (translated or not). Deleted strings will be out.
    • We don't need a dynamic update. We can run this script before releases if there have been changes in lang-en.js

More...

I wait your feedbacks. Thanks!

Joan

jguille2 commented 7 years ago

Hi! I was working into this. I still have only a draft (you can see here) but I want to share this with you... waiting your feedback and directions.

I think hte issue is better explained in the last post, but I try to explicit some things to encourage discussion.

This proposal is not a real change (not a pot system...), more a methodological issue... but I think it can help us.

Some points ...

Examples and draft work...

I wait your feedback... Thanks,

Joan

DyslexicAwe commented 7 years ago

Great idea for translators and I hope it will succeed.

Examples and draft work...

  • You can see a draft version for a Snap! translation tool.
  • Now I can build the master lang-en.js from any language file. I used Catalan translation (with 800 strings) to build this.

I don't quite understand where did the 800 strings come from? Did you manually collect those 800 strings from the code, or did you find them already in lang-pt.js (if so, how they got there in the first place)? And in future, are only lang-XX.js files going to be updated to reflect the changes in the master template? Or will ( after the code changes will be made for next version of Snap! by Jens, and your tool will be run to do what it does ) the master template lang-en.js be (or not be) synchronized with the code changes again? I guess not.

I'm just curious :-)

jguille2 commented 7 years ago

Hi @DyslexicAwe,

@jmoenig, Do you want I update all lang-xx.js files? The behaviour will not change compared to the current... but all files will have these 800 strings. You can check the result in the lang-de.js example. If you are agree that lang-en.js will be the master template and you prefer the actual structure (sorted by themes) I will build a lang-en.js with the themed structure (like actual catalan file) and all the other translation files will have the alphabetical non commented order.

Or you can ask me for another proposal and I will be working on it.

Joan

jmoenig commented 7 years ago

Hi @jguille2 , from what I understand this sounds like a great proposal to harmonize translations and help translators stay abreast of new strings as they are introduced. I'd love to learn more and perhaps discuss this with you in person. Maybe we can find some time in January for a Skype call?

jguille2 commented 7 years ago

Ok @jmoenig I'll send you a mail and we'll see...

For translators who want to update their language (@DyslexicAwe told about "an awesome Seasons Holiday gift for all translators")... they can run the script...but I could also send an updated file to them...

But until we close this issue and decide the file format, I think they should continue with the traditional method. They can take the lang-ca.js as a template to have the maximum translatable strings in their language.