Skip to content
Snippets Groups Projects
Commit 609636a2 authored by Frank Duncan's avatar Frank Duncan
Browse files

Internationalize and Localize

parent ac311cb5
No related branches found
No related tags found
No related merge requests found
...@@ -8,5 +8,13 @@ ...@@ -8,5 +8,13 @@
"rankedchoice-desc": "Specialized Extension to rank pages for purposes of voting and scoring", "rankedchoice-desc": "Specialized Extension to rank pages for purposes of voting and scoring",
"rankedchoice-tag": "Choice #$1", "rankedchoice-tag": "Choice #$1",
"rankedchoice-rankedscore-page": "Page", "rankedchoice-rankedscore-page": "Page",
"rankedchoice-rankedscore-score": "Cumulative",
"rankedchoice-rankedscore-results": "Individual",
"rankedchoice-rankedscore-comments": "Comments",
"rankedchoice-widget-currently-selected": "Currently Selected",
"rankedchoice-widget-deselect": "Deselect",
"rankedchoice-widget-select": "Select this page",
"rankedchoice-widget-comment": "Comment:",
"rankedchoice-widget-save": "Save",
"rankedscore": "Ranked Score" "rankedscore": "Ranked Score"
} }
...@@ -22,11 +22,19 @@ class RankedChoiceWidget { ...@@ -22,11 +22,19 @@ class RankedChoiceWidget {
$params = []; $params = [];
$params["choices"] = RankedChoiceWidget::buildChoiceParams($parser->getUserIdentity(), $parser->getTitle()); $params["choices"] = RankedChoiceWidget::buildChoiceParams($parser->getUserIdentity(), $parser->getTitle());
$params["comment"] = RankedChoice::getByPage($parser->getUserIdentity(), $parser->getTitle())->getComment(); $params["comment"] = RankedChoice::getByPage($parser->getUserIdentity(), $parser->getTitle())->getComment();
foreach([ "currently-selected", "deselect", "select", "comment", "save" ] as $msg) {
$params["$msg-msg"] = wfMessage("rankedchoice-widget-$msg");
};
return [RankedChoiceWidget::buildTemplateParser()->processTemplate("widget", $params), "isHTML" => true]; return [RankedChoiceWidget::buildTemplateParser()->processTemplate("widget", $params), "isHTML" => true];
} }
public static function renderChoices($user, $title) { public static function renderChoices($user, $title) {
$params = [];
$params["choices"] = RankedChoiceWidget::buildChoiceParams($user, $title); $params["choices"] = RankedChoiceWidget::buildChoiceParams($user, $title);
foreach([ "currently-selected", "deselect", "select" ] as $msg) {
$params["$msg-msg"] = wfMessage("rankedchoice-widget-$msg");
};
return RankedChoiceWidget::buildTemplateParser()->processTemplate("widget-list", $params); return RankedChoiceWidget::buildTemplateParser()->processTemplate("widget-list", $params);
} }
......
...@@ -71,8 +71,10 @@ class RankedScore extends \SpecialPage { ...@@ -71,8 +71,10 @@ class RankedScore extends \SpecialPage {
}); });
$params = [ $params = [
"pages" => $pages, "pages" => $pages,
"page-msg" => wfMessage("rankedchoice-rankedscore-page"),
]; ];
foreach(["page", "score", "results", "comments"] as $msg) {
$params["$msg-msg"] = wfMessage("rankedchoice-rankedscore-$msg");
}
$this->getOutput()->addWikiTextAsInterface($this->templateParser->processTemplate("special-rankedscore", $params)); $this->getOutput()->addWikiTextAsInterface($this->templateParser->processTemplate("special-rankedscore", $params));
} }
......
{| class="wikitable sortable rankedchoice--score-table" {| class="wikitable sortable rankedchoice--score-table"
! {{page-msg}} ! {{page-msg}}
! Score ! {{score-msg}}
! Results ! {{results-msg}}
! Comments ! {{comments-msg}}
{{#pages}} {{#pages}}
{{#display}} {{#display}}
|- |-
......
...@@ -3,14 +3,14 @@ ...@@ -3,14 +3,14 @@
<li> <li>
<span class="tag">{{tag}}:</span> <span class="tag">{{tag}}:</span>
{{#thispage}} {{#thispage}}
<span class="currently-selected">Currently selected</span><span class="unselect clickme" data-choice-name="{{name}}">Deselect</span> <span class="currently-selected">{{currently-selected-msg}}</span><span class="unselect clickme" data-choice-name="{{name}}">{{deselect-msg}}</span>
{{/thispage}} {{/thispage}}
{{^thispage}} {{^thispage}}
{{#page}} {{#page}}
<a href="{{localurl}}">{{name}}</a> <a href="{{localurl}}">{{name}}</a>
{{/page}} {{/page}}
{{^page}} {{^page}}
<span class="select clickme" data-choice-name="{{name}}">Select this page</span> <span class="select clickme" data-choice-name="{{name}}">{{select-msg}}</span>
{{/page}} {{/page}}
{{/thispage}} {{/thispage}}
{{/choices}} {{/choices}}
......
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
{{>widget-list}} {{>widget-list}}
</div> </div>
<div class="comment-form"> <div class="comment-form">
<div><label>Comment:</label><div class="autogrow-textarea"><!-- This comment added to prevent mediawiki parser from adding <p> elements in BlockLevelPass.php <pre>--><textarea class="comment">{{comment}}</textarea><!--</pre>--> <div><label>{{comment-msg}}</label><div class="autogrow-textarea"><!-- This comment added to prevent mediawiki parser from adding <p> elements in BlockLevelPass.php <pre>--><textarea class="comment">{{comment}}</textarea><!--</pre>-->
</div></div> </div></div>
<div><button class="submit" disabled>Save</button> <span class="message"></span></div> <div><button class="submit" disabled>{{save-msg}}</button> <span class="message"></span></div>
</div> </div>
</div> </div>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment