-
Notifications
You must be signed in to change notification settings - Fork 33
i18n Colorset translations #181
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
Conversation
This is a proof of concept for #167 and #169, adds basic functionality for translation the names of colors in colorsets while still keeping them modular. @techninja and I talked about the main issues with this still, mainly including the namespaces in the colorset JSON file, and the general functionality (or lack thereof) of translations in modes.
New translation file from @RI0
Awesome, thank you guys for your work so far. This is complicated and hasn't been done anywhere in the system yet, there's likely to be some confusion in how to make it all work, or the best path, so there's likely to be a bit of discussion here. Colors as numbers in translation key:I mentioned in some late night video call that I was on the fence about non-specific color names. One of the whole points of translation string keys is that they are a source language reference, like In a way, the translation files themselves define the content, why have a definition file filled with known expected strings that will be mostly the same? It's silly. Perhaps what might be better: Have the translation strings in the files as expected, in their current format of color0-7, type, manufacturer, etc... But remove any reference from the colorset definition file. IN that way, all the translatable strings stay in their translation files, and non-translatable stuff like what media it's for and the color values (as an non-keyed array). Then when you want to output the translations, you simply know what key to use as it's standardized. Simplifies the format, and clarifies the use. If you want I can submit a PR to your branch here so you can get an idea of what I'm talking about. |
I think I get the idea enough to not require you to make a PR to the branch. I think removing the i18n strings from the definition file will make a lot more sense than the system I had implemented. These are the things that I plan to change in colorset translation (serves as a list for me to follow and let me know if there's anything I should change further) : |
Sounds good except: |
Would it make sense to use the hex code as a key and then have We should have all the English versions so any colour that does |
We are planning on splitting up the data into two separate places: all the translation data will stay in the i18n files and the remaining data will be in the definiton file. The colors will be stored in a non-keyed array, like this: and the color definitions will look like this: "color0": "Black", We plan on putting it so that color0 will be the name for the color in the 0th position of the non-keyed array. |
Just committing the data files so @RI0 can see the format.
@RI0 you may want to have a look at these files in my branch: |
Adjust globe icon location for language select menu
After a VERY busy week of me not having time to work on robopaint, I finally got colorset translations DONE and WORKING (for the most part)! I was only able to port the colorsets over to English, but this gives our translation gurus a template to work off of. Anyways, here's a feature list: - Added i18n folders and en-US translation files for respective colorsets - Modified colorset definition files to move all text elements to i18n files. - Modified colorset parser to get text from i18n file and reference a non-keyed color array.
Just got colorset translations to work! Before this is ready to be pulled, we need translations for colorsets for Spanish and French. If you switch languages in a colorset other than generic you get a FOVBBUC (Flash of Very Big Butt Ugly Content) due to a lack of translation file for that colorset! |
Roger and I have discussed this in great detail over an hour or so and we should be in good shape to make this real very soon. Translations of color names will be easier, the format is simpler (mostly), and the general readability and output will be cleaned up. @rogerfachini make sure to post screenshots in two languages when complete :) |
After some very through discussion with @techninja, we decided on this new format for colorsets that is more translation friendly. - Global colorsets i18n file for color and media names - definition files give the media, a machine name for referencing translatable text, and colors in a non-keyed array but with keyed colors for translation. - individual colorset i18n files give name, description, etc.
Great work so far, though I think you'll need to re-merge current master before I can get this in. Also you've got a bit more work to finish up the format of non-crayola files. Seems right on track for 0.9.5, but not for 0.9.2. |
Not quite sure I can find what I missed in the non-crayola files. Been looking through them and they seem to match. Working on the parsing code now, should be done fairly soon. |
"basetype": "colorset" | ||
}, | ||
"info0": { | ||
"media": "watercolor", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be no "media" here. Also the file name is wrong. Actually this whole file is wrong!
The size of the drop-down seems to have.. gone full width :P And it seems you've forgotten to remove the bold titles & media type output. Remember, no titles, just a bold manufacturer, a dash, the name (same line), then a newline space, and the description. That, or leave it and make sure the translation of the media type gets in there and we deal with the re-layout of this for the Eggbot stuff that will be completely redoing it... |
@@ -550,40 +552,48 @@ function getColorsets() { | |||
continue; | |||
} | |||
|
|||
// Move through all colorsets in file | |||
// Move through all colorsets in file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't have to fix this, but look hard at every line in your commit diffs, it's easy to see little changes where you didn't intend that way.
Thanks to @docprofsky 's translator (with a hotfix by me to get it to work), we now have preliminary translations for the other languages!
// Report language switch to the console | ||
console.info("Language Switched to: " + robopaint.settings.lang); | ||
// Reload and reparse colorsets | ||
getColorsets(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is likely an unfortunate requirement. You either have to pull out string output from initial load, or you can reload the data over again. I suspect there's some efficiencies to be had in refactoring some of getColorSets()
, but it's a very low volume function and as long as you've got it working, we're probably just fine :)
Ok got the VERY fast translations in, there are some mistakes that we may have to catch later, but for now it works. Thank you for the present by the way. And just to clarify, the 🍰 is not a lie! |
@rogerfachini Can you submit a PR with the fix? I tested it and it seemed to work fine (other than it changing the order of the JSON). |
"creator": "rogerfachini" | ||
}, | ||
"metallic": { | ||
"description": "Prang m\u00e9talliques Aquarelles 8 semi-humides, set 8 couleurs", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For some reason, by default Python JSON output is ASCII safe, and therefore doesn't store the actual non-ascii unicode chars as the actual chars. Every part of our workflow should be Unicode safe, so I'd suggest seeing if you can't tweak the output as explained here.
@docprofsky its not worth PR-ing: I just removed the command-line arguments (I wanted to run the script from my editor to make it easier) and made it easier to translate 10 or so different files in a row and get them into my repo. |
@rogerfachini Make sure the colorset dropdown doesn't randomly change width, that the JSON problems noted above are fixed, that the media type translates, and I'll merge it. |
The colorset dropdown is due to the largest item in it (In the broken translation picture this was due to the raw translation string being outputted, in the last picture the largest item was the french translation for 'add custom colorset', so that shouldn't be a problem). @docprofsky can fix the python side of the translation file issues but for now I will fix them manually. Should I just remove the media type from the list completely as it is unnecessary at this point (but can be re-added later)? |
Translate it. Better to correct what's there than pull out too much before a big refactor. |
And yea, make the JSON changes by hand, should be happy :) |
Translate the media, too.
Fixed all the glitches caused by @docprofsky 's very-much-in-beta translator!
That should fix all the annoying glitches in the translate files. |
"yellow": "Amarillo", | ||
"yellowgreen": "Verde Amarillo", | ||
"redviolet": "Rojo Violeta", | ||
"orangered": "Orangered", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😢 It appears "orangered" is not a translatable color. See if you can't cherry pick that to just be "orange red" before translation :P
REALLY close now! I can feel it. Fix the two little issues I've got there, upload a new screenshot and I'll merge this thing in! |
Ok, ok. No need to hold this thing back for anymore petty crap. It is good (enough)! |
Let the race to get in the Chinese translations, begin! ;) |
And let the headaches ensue! |
This should translate the colorsets successfully. Currently only the generic-standard colorset has translation files, though.