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
Add i18n #27
Add i18n #27
Conversation
Niharika29
commented
Sep 15, 2016
- Add SimpleI18n support to project
- Extract out all message keys to en.json
- Replace all keys in twig and js by message keys
- Update README
"js-unauthorized": "You need to be logged in to be able to review.", | ||
"js-dberror": "There was an error in connecting to database.", | ||
"js-undo-own-only": "You can only undo your own reviews.", | ||
"js-unknown-error": "An unknown error occurred when loading results. Please try again." |
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.
The only thing is I would avoid including links and markup in the messages. E.g. you get rid of footer-source
and instead just have "source": "Source"
and our HTML, <a href="https://github.com/wikimedia/PlagiabotWeb">{{ 'source'|message }}</a>
. The markup is not translatable and there's a chance someone might unintentionally break it.
And for footer-poweredby
you could use: Powered by $1 and $2
since EranBot and Turnitin are also not translatable. If they are, make a separate message for turnitin
then in our HTML:
{{ 'footer-poweredby'|message | ( <a href="https://en.wikipedia.org/wiki/Wikipedia:Turnitin">{{ 'turnitin'|message }}</a> | <a href="https://en.wikipedia.org/wiki/User:EranBot">{{ 'EranBot'|message }}</a> }}
(this is pseudocode, not sure how SimpleI18n works)
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.
Also it should be https://github.com/wikimedia/CopyPatrol
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.
Updated. I also fixed some links in Image attribution modal. I didn't break it up into 12 messages but 8 instead.
The link in footer is https://github.com/wikimedia/CopPatrol
only. Did you see otherwise anywhere?
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.
Also, simpleI18n doesn't support the sort of markup you were suggesting above so I resorted to break out the text.
Trying out these Gerrrit-wannabe features on GitHub, "Changes requested" doesn't mean I'm demanding any changes! |
I pushed directly to your branch, hope that's OK... To pass markup containing messages as a parameter to a message, I found you could use A few notes that I've learned doing i18n:
Sorry if I'm being anal! I just think we should try to make it easy as possible for the translatewiki folks, because they are awesome. Other not important things:
That is the extent of my stupid quibbles! |
For Copypatrol, I think I agree. When I did i18n for Wikimania scholarships app and Grants app, it was very prone to interface changes from time to time and hence separate keys were encouraged.
Got it.
Thanks for reminding me to do this!
Agreed. :)
I've worked with twig before for quite a while (here, for example) and never used spaces with the pipe separator. If you don't mind, I'll like to continue to have it that way.
Oh, right.
Will remember in future. |
safe - dont fail on missing metadata
"phabricator": "Phabricator", | ||
"footer-imageattr": "Image attribution", | ||
"lboard-title": "Leaderboard", | ||
"lboard-week": "Cases closed in the<br/> last 7 days", |
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.
Hardcoded linebreaks don't really work for translation, since the translators won't know where to put the linebreaks to make sure things wrap correctly. Danny originally wanted this done so that all the columns lined up right, but we can probably figure out a better way to do this in a future commit. For now, let's just remove the line breaks and let the lines wrap naturally (even if they don't all line up perfectly).
"form-mine": "My reviews", | ||
"form-drafts": "Drafts only", | ||
"wikiprojects": "Wikiprojects", | ||
"form-wikiprojects-placeholder": "Type Wikiproject names...", |
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.
"WikiProject" is always camelcase.
Other trivial changes
I've made the fixes and rebased the patch. I took this opportunity to split out the header, footer and modal templates from the base template. The code was nearly incomprehensible. |
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.
A few nits inline. Mostly about making the qqq descriptions more useful for translators.
$editor = null; | ||
if ( isset( $record['diff'] ) && isset( $editors[$record['diff']] ) ) { | ||
$editor = $editors[$record['diff']]; | ||
} |
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.
Block overindented?
"documentation": "Link to documentation in header\n{{Identical|Documentation}}", | ||
"feedback": "Link to feedback in header\n{{Identical|Feedback}}", | ||
"leaderboard": "Link to leaderboard in header", | ||
"login": "Butten label\n{{Identical|login}}", |
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.
"Button"
"record-editcount": "Label to indicate number of edits a user has made", | ||
"compare": "Button label to open a panel for text comparison between two pages", | ||
"record-ithenticate": "Button label for a button to go to the original plagiarism report generated by Turnitin", | ||
"record-url-text": "Label text to show amount of plagiarism.\n Parameters: $1 - Percentage of edit that was plagirized.\n $2 - Number of words plagiarized.", |
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.
"plagiarized"
"compare-source-loading": "Temporary text shown to user while copyvio text source loads", | ||
"footer-loadmore": "Label for a button to load more records.", | ||
"footer-nomore": "Label to indicate no more records in database.", | ||
"footer-broughtby": "Footer text to indicate authors. \n Parameters: $1 - String.", |
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.
$1 - List of names?
"footer-nomore": "Label to indicate no more records in database.", | ||
"footer-broughtby": "Footer text to indicate authors. \n Parameters: $1 - String.", | ||
"footer-commtech": "Footer text - name of team.", | ||
"footer-poweredby": "Footer text to highlight sources used for development. \n Parameters: $1 - String. $2 - String.", |
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.
"String" is not descriptive at all for a translator.
"public-domain": "Text as part of the attributions box", | ||
"open-font-license": "Text as part of the attributions box", | ||
"imageattr-paragraph1": "Text as part of the attributions box. \n Parameters: $1, $2, $3, $4 - Strings.", | ||
"imageattr-paragraph2": "Text as part of the attributions box. \n Parameters: $1, $2, $3 - Strings.", |
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.
Again, the "Strings" description won't help a translator understand the resulting sentence/phrase.
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.
We might want to make it clear the imageattr messages should be gender-neutral (User:Xander89 hasn't specified their gender, other proper nouns are not human) and that {{GENDER}} should not be used, since the parameters are links. In Intuition a PHP error is thrown if GENDER is used on markup, I think, not sure if the same is true for Simplei18n
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.
A couple qqq suggestions.
"Ryan Kaldari" | ||
] | ||
}, | ||
"name": "Title of the application/tool", |
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 may want to mark this one as optional to translate, since it's a proper noun and a translation isn't strictly needed. To mark something as optional to translate, add {{Optional}}\n to the beginning of it.
"name": "Title of the application/tool", | ||
"documentation": "Link to documentation in header\n{{Identical|Documentation}}", | ||
"feedback": "Link to feedback in header\n{{Identical|Feedback}}", | ||
"leaderboard": "Link to leaderboard in header", |
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.
"Leaderboard" may be tricky to understand. You might want to explain this better, like "Link to a list of the top reviewers in header".
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.
LGTM