Skip to content
This repository was archived by the owner on May 28, 2026. It is now read-only.

Commit 9f6977b

Browse files
authored
Add lang-switching dropdown to site footer
Add a form to the site footer with which to change the current uselang setting, with a dropdown containing all available translation languages. Bug: T416783
1 parent 969390a commit 9f6977b

3 files changed

Lines changed: 38 additions & 15 deletions

File tree

i18n/en.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
"api-tooltip": "View the API documentation",
3131
"version": "Version $1",
3232
"report-issue": "Report an issue",
33+
"language": "Language:",
34+
"language-switch": "Switch language",
3335
"langs-placeholder": "Leave blank for automatic language detection.",
3436
"langs-param-error": "The following {{PLURAL:$1|language is|languages are}} not supported by the OCR engine: $2",
3537
"loading-message": "Performing transcription...",

i18n/qqq.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@
3737
"api-tooltip": "Tooltip for the API link in the footer.",
3838
"version": "Link text in the footer for the source code link.\n\nParameter:\n* $1 – the current application version number.\n\n{{identical|Version}}",
3939
"report-issue": "Link text in the footer for the issue-reporting link.",
40+
"language": "Label for the language-switching dropdown.",
41+
"language-switch": "Button text for the language-switching dropdown.",
4042
"langs-placeholder": "Placeholder text for the language input field.",
4143
"langs-param-error": "Error message displayed when invalid language(s) are submitted.\n\nParameters:\n* $1 – number of invalid languages\n* $2 - the list of invalid languages\n\nOCR is a common abbreviation in English for \"Optical Characters Recognition\".",
4244
"loading-message": "Loading message displayed when the transcription is being performed",

templates/base.html.twig

Lines changed: 34 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -55,21 +55,40 @@
5555

5656
<hr/>
5757
<footer>
58-
<a target="_blank" href="https://github.com/wikimedia/wikimedia-ocr/releases/tag/{{ git_tag() }}">
59-
{{ msg('version', [git_tag()]) -}}
60-
</a>
61-
&bull;
62-
<a target="_blank" href="https://www.mediawiki.org/wiki/Help:Extension:Wikisource/Wikimedia_OCR">
63-
{{ msg('documentation') -}}
64-
</a>
65-
&bull;
66-
<a href="{{ path('app.swagger_ui') }}" title="{{ msg('api-tooltip') }}">
67-
{{ msg('api') -}}
68-
</a>
69-
&bull;
70-
<a target="_blank" href="https://phabricator.wikimedia.org/maniphest/task/edit/form/1/?tags=wikimedia_ocr">
71-
{{ msg('report-issue') -}}
72-
</a>
58+
<p>
59+
<a target="_blank" href="https://github.com/wikimedia/wikimedia-ocr/releases/tag/{{ git_tag() }}">
60+
{{ msg('version', [git_tag()]) -}}
61+
</a>
62+
&bull;
63+
<a target="_blank" href="https://www.mediawiki.org/wiki/Help:Extension:Wikisource/Wikimedia_OCR">
64+
{{ msg('documentation') -}}
65+
</a>
66+
&bull;
67+
<a href="{{ path('app.swagger_ui') }}" title="{{ msg('api-tooltip') }}">
68+
{{ msg('api') -}}
69+
</a>
70+
&bull;
71+
<a target="_blank" href="https://phabricator.wikimedia.org/maniphest/task/edit/form/1/?tags=wikimedia_ocr">
72+
{{ msg('report-issue') -}}
73+
</a>
74+
</p>
75+
<form action="{{path('home')}}" method="get" class="form-inline">
76+
<div class="form-group">
77+
<label for="uselang">{{ msg('language') }}</label>
78+
<select name="uselang" class="form-control" id="uselang">
79+
{% for code,lang in all_langs() %}
80+
<option value="{{code}}" {% if code == lang() %}selected{% endif %}>
81+
{% if lang %}
82+
{{lang}}
83+
{% else %}
84+
({{code}})
85+
{% endif %}
86+
</option>
87+
{% endfor %}
88+
</select>
89+
<input type="submit" value="{{msg('language-switch')}}" class="btn btn-default">
90+
</div>
91+
</form>
7392
</footer>
7493
</main>
7594
</body>

0 commit comments

Comments
 (0)