-
Notifications
You must be signed in to change notification settings - Fork 41
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
Managing roadmap translations #68
Comments
I created a first release (and tag) of the mobile roadmap through GitHub's interface. The content can be downloaded as an archive file, making it easy to translate the right set of HTML files. |
If we add If we add |
Should we create language-specific JS files and template pages? |
Good point. I think we should rather adjust the JS to preserve the |
I never really understood why people continue to use +1 though to using content negotiation For i18n articles we have all translations at the same level, with a |
fwiw, for i18n articles we do that here: https://www.w3.org/International/articlelist That page is content negotiated itself, and shows translated titles where translations exist (click on the language links, top right, to see how it works). Just an idea. I strongly recommend, btw, that every page with a translation carries a link to that translation, on the page itself (for cases where content negotiation doesn't do what's needed). |
Right, I suppose we can override existing content negotiation rules on w3.org Web site with custom .htaccess directives at the directory level.
OK, I personally prefer to use dedicated folders to avoid seeing apparent duplicates for each file in the tree explorer of my text editor, but other people may see things differently ;)
Right, I was thinking that a simple HTML page could be easier to maintain for translators but then we don't really need an HTML page in our case and building the actual mapping table would require small but custom tools. We could perhaps leverage good ol' code, such as gettext and PO files here. It seems to me that it would be useful to maintain such mappings for specification titles and group names independently of this repository in any case. Newsletters we send (e.g. in Chinese) already include translations, but these translations are done on an ad-hoc basis, and not necessarily consistent from one newsletter to the other. Thanks for the comments! |
I could be wrong, but afaia existing content negotiation rules on w3.org work equally well either way. I don't remember having to change anything for the i18n setup when we used multiviews, and i think it's not relevant for .var files. |
And you're most probably right! I always assumed that only the @xfq, I think I still prefer putting files in separate folders but, since you're working on the first translation, feel free to decide otherwise and put all files in the same folder, using the |
A couple more suggestions for consideration.
The answer to this question may depend on how you plan to do content negotiation. If you plan to use multiviews i'm not sure how the server would find the right file if the user types https:/example.org/filename. If you use type maps for content negotiation, the location is less important, but it's slightly more of a pain to create the .var file if the translations are in different directories. Having the files in different directories, imo, also makes it more complicated when linking to either shared or localised images, script files, etc. For example, the translator would need to translate the URIs as well as the content. For the i18n articles we moved away from that at an early stage because it produced more validation work and more errors. Now the translator only needs to change a URL in the content on the rare occasion that they also localise an image. |
Personally, I also prefer putting translations in separate directories. But if it makes the content negotiation config much harder, I can live with putting them in the same directory as the English source files. |
What we had in mind was to have a deploy script that would put files back into the same folder before they get published on w3.org.
Right, here we were planning to use a All in all, the starting point was that we didn't want to have to work on documents named |
Overhaul of the JS code to handle localized versions of roadmap documents. As discussed in w3c#68, the code assumes that the following naming convention is used for all localized files: [name].[lang].[ext] English versions of the files are assumed to be named: [name].[ext] To determine the language of the HTML page to render, the code checks the `lang` attribute on the `<html>` tag. If it not set, it tries to extract the language from the page name (`window.location.pathname`), using the above convention. If if not set, English (`en`) is assumed. The page tries to load localized versions of all files. If not found, it falls back to the English versions. The code issues warnings on the console when it cannot find localized versions of a given file (in some cases, we may not need localized versions, so warnings may not be warranted. However they are useful during development to understand what still needs to be translated). Files that may (and often should!) be localized are: 1. `toc.json`: the labels, descriptions and URLs should be localized 2. `*.html`: the actual contents of the roadmap obviously need to be localized. Note the need to update the `lang` attribute of the `<html>` tag, otherwise the code will consider that the page is in English. 3. `js/template-table-*.html`: the HTML templates used for generated tables. (These templates used to be hardcoded in `generate.js`) 4. `js/translations.[lang].json`: the translations of features, group names, spec titles, and labels that are needed to render the roadmaps. The file is a semi-flat mapping table between the English string and the translated string. First level properties are: "features" for feature names that appear in data files, "groupNames" for translations of group names, "specTitles" for translations of spec titles, "labels" for all other translations. For instance, the beginning of a `js/translations.fr.json` document could be: ``` { "labels": { "shipped": "C'est en prod!", "experimental": "On déboggue", "indevelopment": "On y travaille", "consideration": "On y réfléchit", "N/A": "Non renseigné", "in": "dans" }, "features": { "audio element": "La balise audio", "picture element": "La balise picture" }, "groupNames": { "CSS Working Group": "Le groupe de travail CSS" }, "specTitles": { "Magnetometer": "Magnétomètre" } } ``` The overhaul also adds support for merging features in generated tables when they use the same "data-feature", even if they appear in different parts of the documents (w3c#73).
I implemented some i18n logic in the JS code in PR #110. In the end, I followed the naming convention suggested by @r12a, and the code assumes that this naming convention is being used. One thing that continues to bug me: it seems very convenient to be able to retain HTML files without language indication, typically I do not know if there is an easy way to do that on pages published by GitHub. Through Jekyll perhaps. In the meantime, the code I prepared follows a "file without language indication is the English version" rule, and thus content negotiation is not yet doable. (FYI, the code I prepared does not yet list and add links to available translations either) |
I created #248 to keep track of the content negotiation. I'm closing this issue because the rest should now be done. |
Some notes based on internal discussions for the Chinese translation of the mobile roadmap:
.html.zh
. However, that's not a very convenient way to work with HTML files on GitHub, so idea is rather to use azh
subfolder in themobile
folder. We should be able to avoid having to modify relative links by using a<base>
element. We'll create a publication script as needed before publication.Some things to do:
The text was updated successfully, but these errors were encountered: