-
-
Notifications
You must be signed in to change notification settings - Fork 476
Update structure of translation files for the Reference section #836
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
Update structure of translation files for the Reference section #836
Conversation
Changes made by @outofambit in the PR processing#835. Co-Authored-By: evelyn masso <coding@outofambit.com>
Transform description elements from strings to arrays, to match new format.
Move p5 Classes out of the p5 Class object, to match new format.
Add the script section that swaps text from class pages of the Reference (it currently only performs the swaps in method/fields pages). Update the function with the new JSON format.
I haven't been following this project very closely so sorry if my question is a bit basic or already answered. By "reference JSON files" do you mean these files will be used instead of I've mentioned in another issue before that I've been looking at new tools to generate reference data from the inline documentation and the structure you layout here is very helpful in that sense since if a schema defined I can use There are several ideas that I think I can build on after this project is merged and a schema that defines how the reference data is defined would be a big part of it. |
@limzykenneth By "Reference JSON files" I mean the JSON files used for the translation swapping (es.json, zh-Hans.json...). I'm not making any changes in that sense, so the data.json will still be used to render the English version of the website and the JSON files (es.json, zh-Hans.json...) will be needed for the translation swaps. The need for a defined structure stems from the fact that I created a script that generates the English version of the JSON files, the |
So if I understand that correctly, the output of the comment-parser would be used to both render the Reference section of the website and as a model for other translations (the file to duplicate when starting a new translation)? |
The ideal solution that I can come up with is to use The translation workflow you setup here will also work nicely with it. |
@limzykenneth I agree, rendering the website with the translation files would definitely make more sense. |
Delete redundant JSON entries (see PR processing#802) Fix classes structure Fix some errors caused by the conversion
I'll see if I have some time to update reference rendering once the two PRs are merged. |
I don't think this is the correct spot, but I wanted to mention that we have some of the p5 classes translated into spanish in this doc. We didn't add them into the translation files yet because we weren't sure where they should go, but hopefully it's easier to loop them in with this new structure! @montoyamoraga |
@lmccart That's perfect! I can add them in once I bring all the translation files up to date with the English version (meaning I add all the missing keys to the translation files). -the PR with the script that does this is coming very soon 🙃 |
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.
Thank you @yukienomiya! I'm excited to merge this :)
I'll wait another 24 hours first just in case someone hasn't had a chance yet to share concerns or questions they might have.
@yukienomiya thank you! |
See PR #803
Background
Problems with the existing Reference translation files structure:
In the translated JSONs the descriptions were saved as single strings and therefore displayed on the website as single paragraphs.
The updateLanguage() function that is supposed to swap English text in Reference pages with its translation, currently only translates method/fields pages: the swap doesn't work in Class pages, so for example, even if Class descriptions are translated in the JSON files, the translation is never rendered on the webpage.
Changes:
Convert existing translation files to new format:
Parameter elements saved by their name. (Changes made by @outofambit in the PR Convert exisiting translation files to new format #835.)
Save the "params" elements as object, where each element has a "paramName": "paramType: paramDescription" structure.
Description elements: from strings to arrays of strings.
Convert the descriptions elements from strings to arrays of strings, where each array element represents a paragraph. This change won't make much difference with the already translated descriptions, as they are saved as a single paragraph, but the structure change will be useful when we'll add the rest of the documentation.
Move Classes out of the p5 Class object, to match new format.
Update the updateLanguage() function:
Add script section that swaps text from Class pages of the Reference.
Modify the script so it matches the new Reference JSON structure.
New structure of the Reference JSON files: