Skip to content

Commit

Permalink
Add labels for source and target language selectors
Browse files Browse the repository at this point in the history
Instead of putting a single joining label between the two
selectors (which doesn't work in all languages) this gives them
their own labels (above). Other layout is adjusted to keep things
aligned (e.g. the up- and down-load buttons need to stay aligned
with the language selectors).

Bug: T216054
  • Loading branch information
samwilson committed Jul 23, 2019
1 parent 13ce84f commit 9fc36e0
Show file tree
Hide file tree
Showing 11 changed files with 79 additions and 36 deletions.
26 changes: 10 additions & 16 deletions assets/translate.less
Original file line number Diff line number Diff line change
Expand Up @@ -63,25 +63,18 @@ body.translate {
display: flex;
align-items: center;
> * {
// Get rid of the margin from the following three elements, so the .language-selectors can be treated the
// same as the .buttons element (for vertical positioning).
flex: 1;
// Get rid of the margin from the two child FieldLayout elements, so the .language-selectors
// can be treated the same as the .buttons element (for vertical positioning).
margin-bottom: 0;
}
.source-lang-widget {
flex: 2;
text-align: left;
}
.source-to-target-label {
flex-grow: 2;
text-align: center;
}
.target-lang-widget {
flex: 2;
button {
text-align: left;
width: 100%;
font-weight: normal;
}
width: 100%
}
button {
text-align: left;
width: 100%;
font-weight: normal;
}
}

Expand All @@ -108,6 +101,7 @@ body.translate {
display: flex;
flex-direction: row-reverse;
align-items: center;
margin-top: 2.1rem;
.oo-ui-widget {
margin-right: 0;
}
Expand Down
3 changes: 2 additions & 1 deletion i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
"opens-in-new-tab": "Opens in new tab",
"default-language": "Default language",
"source-lang-not-found": "Untranslated. Default: $1",
"source-to-target": "to",
"source-lang-label": "From:",
"target-lang-label": "To:",
"select-language": "Select a language",
"confirmation-to-switch-target-lang": "You are trying to change the translation language but you have unsaved translations. Changing the language will result in loss of any added translations. Please upload the translations to Commons or download the translated file before proceeding. Do you wish to continue?",
"confirm-change-target-lang": "Change language",
Expand Down
3 changes: 2 additions & 1 deletion i18n/qqq.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@
"opens-in-new-tab": "Tooltip text for links that will open in a new browser tab.",
"default-language": "Label at the top of the source-language dropdown list indicating that the SVG file's default language will be used (we don't know what the specific language is).",
"source-lang-not-found": "Label shown when the selected source-language is not available. $1 is the label in the default language (we don't know what the specific language is).",
"source-to-target": "Joining label between the source-language selector and the target language selector.",
"source-lang-label": "Label for the source-language dropdown list.",
"target-lang-label": "Label for the target-language popup.",
"select-language": "Default text of the destination language selector.",
"confirmation-to-switch-target-lang": "Confirmation message shown when a user tries to switch the target language but has unsaved changes in the form.",
"confirm-change-target-lang": "Label for the confirm button for {{msg-wm|confirmation-to-switch-target-lang}}, to appear next to 'Cancel' (i.e. {{wm-msg|ooui-dialog-message-reject}}).",
Expand Down

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion public/assets/entrypoints.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"entrypoints": {
"app": {
"css": [
"assets/app.20b30e8e.css"
"assets/app.88dbfd1c.css"
],
"js": [
"assets/app.9cb6b564.js"
Expand Down
3 changes: 2 additions & 1 deletion public/assets/i18n/app/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
"opens-in-new-tab": "Opens in new tab",
"default-language": "Default language",
"source-lang-not-found": "Untranslated. Default: $1",
"source-to-target": "to",
"source-lang-label": "From:",
"target-lang-label": "To:",
"select-language": "Select a language",
"confirmation-to-switch-target-lang": "You are trying to change the translation language but you have unsaved translations. Changing the language will result in loss of any added translations. Please upload the translations to Commons or download the translated file before proceeding. Do you wish to continue?",
"confirm-change-target-lang": "Change language",
Expand Down
47 changes: 45 additions & 2 deletions public/assets/i18n/app/he.json
Original file line number Diff line number Diff line change
@@ -1,24 +1,67 @@
{
"@metadata": {
"authors": [
"Steeve815"
"Steeve815",
"YaronSh"
]
},
"svgtranslate": "תרגום SVG",
"info": "סיוע בתרגום תוויות טקסט בקובצי SVG. יש לבחור קובץ בוויקישיתוף כדי להתחיל.",
"beta": "תכונה זה נמצאת בשלבי בדיקה ראשוניים.",
"learn-more": "מידע נוסף ומשוב!",
"return-to-home": "חזרה לעמוד הבית",
"help": "עזרה",
"login": "כניסה לחשבון",
"logout": "יציאה מהחשבון",
"logged-in-as": "נכנסת בשם $1",
"language-settings": "הגדרות שפה",
"done": "סיום",
"cancel": "ביטול",
"interface-lang-field-label": "שפת הכלי:",
"interface-lang-field-help": "הכלי עצמו יוצג בשפה זו.",
"preferred-langs-field-label": "שפות מועדפות לתרגם מהן/אליהן:",
"preferred-langs-field-help": "השפות האלו תופענה בראש הרשימה בעת מעבר בין אחת לשנייה בעמוד התרגום.",
"add-preferred-lang": "הוספה",
"search-help": "נא להקליד שם קובץ מוויקישיתוף",
"search-label": "שם קובץ (ללא הקידומת ‚File:‎/קובץ:’) או כתובת:",
"search-placeholder": "100 Years War France 1435.svg",
"translate-button": "תרגום",
"no-translations": "לקובץ זה אין תוויות שזמינות לתרגום. נא לבחור בתמונה אחרת.",
"not-found": "לא ניתן למצוא את הקובץ שביקשת. נא לבחור בתמונה אחרת.",
"pick-another": "→ בחירה בקובץ אחר",
"view-on-commons": "צפייה בוויקישיתוף",
"opens-in-new-tab": "נפתח בלשונית חדשה",
"default-language": "שפת בררת מחדל",
"source-lang-not-found": "ללא תרגום. בררת מחדל: $1",
"source-to-target": "ל",
"select-language": "נא לבחור בשפה",
"confirmation-to-switch-target-lang": "פעולה זו היא ניסיון להחלפת שפת התרגום אך יש לך תרגומים שלא נשמרו. החלפת השפה תוביל לאבדן התרגומים שנוספו. נא להעלות את התרגומים לוויקישיתוף או להוריד את הקובץ שתרגמת בטרם המשך התהליך. להמשיך?",
"confirm-change-target-lang": "שינוי שפה",
"upload-button-label": "העלאה לוויקישיתוף",
"upload-button-in-progress": "מעלה לוויקישיתוף...",
"upload-login-warning": "יש להיכנס כדי לאפשר העלאה",
"download-button-label": "הורדה",
"download-or-upload": "או",
"translation-image-alt": "התמונה שמתורגמת כעת. אין תיאור זמין.",
"preview-error-occurred": "אירעה שגיאה בעת קבלת התצוגה המקדימה. נא להמשיך לתרגם, אך אם התקלה הזו נמשכת יש לדווח על תקלה (דרך הקישור שבתחתית העמוד להלן).",
"download-icon-alt": "סמל שמציין הורדת קובץ",
"pick-an-image-title": "נא לבחור תמונה",
"pick-an-image-desc": "מוויקישיתוף.",
"translate-icon-alt": "סמל שמציין מספר שפות",
"translate-labels-title": "תרגום",
"translate-labels-desc": "התוויות בתמונה.",
"commons-logo-alt": "לוגו ויקישיתוף",
"update-commons-title": "עדכון ויקישיתוף",
"update-commons-desc": "או הורדה ישירות למחשבך.",
"upload-complete": "ההעלאה הושלמה",
"upload-complete-message": "תודה רבה! התרגום שערכת ל־$1 נשלח. ממליצים לך להמשיך ולתרגם את התוויות ולהעלות שוב כדי לעדכן את התמונה.",
"upload-complete-commons": "הצגת התמונה",
"upload-complete-translate-another": "תרגום תמונה נוספת",
"licenced-under": "ברישיון GPL 3.0 ומעלה",
"developed-by": "פותח על ידי צוות Community Tech",
"report-issue": "דיווח על באג"
"toolforge-logo-alt": "סמל ה‚סדן’ של Toolforge",
"powered-by-toolforge": "מופעל על גבי Toolforge",
"privacy-policy": "מדיניות פרטיות",
"report-issue": "דיווח על באג",
"view-source": "צפייה ב־Github"
}
3 changes: 2 additions & 1 deletion public/assets/i18n/app/qqq.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@
"opens-in-new-tab": "Tooltip text for links that will open in a new browser tab.",
"default-language": "Label at the top of the source-language dropdown list indicating that the SVG file's default language will be used (we don't know what the specific language is).",
"source-lang-not-found": "Label shown when the selected source-language is not available. $1 is the label in the default language (we don't know what the specific language is).",
"source-to-target": "Joining label between the source-language selector and the target language selector.",
"source-lang-label": "Label for the source-language dropdown list.",
"target-lang-label": "Label for the target-language popup.",
"select-language": "Default text of the destination language selector.",
"confirmation-to-switch-target-lang": "Confirmation message shown when a user tries to switch the target language but has unsaved changes in the form.",
"confirm-change-target-lang": "Label for the confirm button for {{msg-wm|confirmation-to-switch-target-lang}}, to appear next to 'Cancel' (i.e. {{wm-msg|ooui-dialog-message-reject}}).",
Expand Down
2 changes: 2 additions & 0 deletions public/assets/i18n/app/sv.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@
"upload-complete-translate-another": "Översätt en annan bild",
"licenced-under": "Licenserad under GPL 3.0 eller senare",
"developed-by": "Utvecklades av Community Tech",
"toolforge-logo-alt": "Toolforges städlogotyp",
"powered-by-toolforge": "Drivs av Toolforge",
"privacy-policy": "Integritetspolicy",
"report-issue": "Rapportera en bugg",
"view-source": "Visa på Github"
Expand Down
2 changes: 1 addition & 1 deletion public/assets/manifest.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"assets/app.css": "assets/app.20b30e8e.css",
"assets/app.css": "assets/app.88dbfd1c.css",
"assets/app.js": "assets/app.9cb6b564.js",
"assets/grabbing.cur": "assets/a8c874b93b3d848f39a71260c57e3863.cur",
"assets/grab.cur": "assets/b06c243f534d9c5461d16528156cd5a8.cur",
Expand Down
22 changes: 11 additions & 11 deletions src/Controller/TranslateController.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
use Krinkle\Intuition\Intuition;
use OOUI\ButtonInputWidget;
use OOUI\DropdownInputWidget;
use OOUI\Element;
use OOUI\FieldLayout;
use OOUI\HorizontalLayout;
use OOUI\LabelWidget;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
Expand Down Expand Up @@ -127,32 +129,30 @@ public function translate(
}
}
$sourceLang = new DropdownInputWidget([
'label' => $intuition->msg('source-lang-label'),
'options' => $availableLangs,
// @TODO Get this value from the session.
'value' => 'fallback',
'classes' => ['source-lang-widget'],
'infusable' => true,
]);
$sourceLangField = new FieldLayout($sourceLang, [
'label' => $intuition->msg('source-lang-label'),
'align' => 'top',
]);
$targetLangDefault = 'fallback';
$targetLangLabel = $intuition->msg('select-language');
$targetLang = new ButtonInputWidget([
'label' => $targetLangLabel,
'value' => $targetLangDefault,
'classes' => ['target-lang-widget'],
'indicator' => 'down',
'infusable' => true,
'name' => 'target-lang',
]);
$targetLangField = new FieldLayout($targetLang, [
'label' => $intuition->msg('target-lang-label'),
'align' => 'top',
]);
$languageSelectorsLayout = new HorizontalLayout([
'items' => [
$sourceLang,
new LabelWidget([
'label' => $intuition->msg('source-to-target'),
'classes' => ['source-to-target-label'],
]),
$targetLang,
],
'items' => [$sourceLangField, $targetLangField],
'classes' => ['language-selectors'],
]);

Expand Down

0 comments on commit 9fc36e0

Please sign in to comment.