Make first-time tips and about dialogs fully translatable

Aside from the about dialog's copyright notice text. Closes #664.
This commit is contained in:
Oliver Hamlet
2016-12-29 10:49:57 +00:00
parent ce87f3e188
commit bf6c5224af
6 changed files with 86 additions and 25 deletions
+7 -1
View File
@@ -54,7 +54,13 @@ Some languages may use different words or phrases for different contexts where o
Some strings to be translated may contain special characters. Different types of special character that may be encountered are:
* Backslashes (`\`). These are used to escape backslashes and double-quotation marks (`"`) in the C++ translation strings. Don't add new backslashes into translations, and make sure all backslashes in the original string are retained in the translation.
* Formatting placeholders are used so that LOOT can substitute text or numbers that are generated at runtime into pre-made strings. They appear as a number surrounded by percentage signs, eg. `%1%`, or as `%s`. If formatting placeholders are used in the untranslated string, they **must all** be present in the translated string, or LOOT will crash when it tries to display the translated string. Placeholders can be moved around so that the sentence makes grammatical sense in the target language.
* Formatting placeholders are used so that LOOT can substitute text or numbers that are generated at runtime into pre-made strings. They appear in a few different formats:
1. A number surrounded by percentage signs, eg. `%1%`.
2. A named placeholder, eg. `%(icon)s` (the name in parentheses must not be changed).
3. A simple placeholder `%s`.
If formatting placeholders are used in the untranslated string, they **must all** be present in the translated string, or LOOT will encounter an error when it tries to display the translated string. Placeholders can be moved around so that the sentence makes grammatical sense in the target language.
* A small number of strings also include HTML `<span>` elements that wrap translatable text. While the text inside the elements should be translated, the element tags and their attributes should not be.
### Adding A New Translation
+51 -8
View File
@@ -6,9 +6,9 @@
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: LOOT 0.10.1\n"
"Project-Id-Version: LOOT 0.10.2\n"
"Report-Msgid-Bugs-To: https://github.com/loot/loot/issues\n"
"POT-Creation-Date: 2016-12-20 15:36+0000\n"
"POT-Creation-Date: 2016-12-29 10:46+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -133,7 +133,7 @@ msgstr ""
msgid "Error"
msgstr ""
#: src/gui/html/js/initialise.js:250
#: src/gui/html/js/initialise.js:249
#, javascript-format
msgid "A [new release](%s) of LOOT is available."
msgstr ""
@@ -310,7 +310,7 @@ msgid "Editor Is Open"
msgstr ""
#: src/gui/html/js/translateStaticText.js:116
#: src/gui/html/js/translateStaticText.js:308
#: src/gui/html/js/translateStaticText.js:316
msgid "OK"
msgstr ""
@@ -601,36 +601,79 @@ msgid "First-Time Tips"
msgstr ""
#: src/gui/html/js/translateStaticText.js:302
#, javascript-format
msgid ""
"This appears to be the first time you have run LOOT v%s. Here are some tips "
"to help you get started with the interface."
msgstr ""
#: src/gui/html/js/translateStaticText.js:304
msgid "Click %(menu_icon)s buttons to open menus."
msgstr ""
#: src/gui/html/js/translateStaticText.js:307
msgid ""
"As well as messages, LOOT displays plugin <span class=\"version\">version "
"numbers</span>, <span class=\"crc\">CRCs</span> and Bash Tag suggestions for "
"<span class=\"tag add\">addition</span> and <span class=\"tag remove"
"\">removal</span>."
msgstr ""
#: src/gui/html/js/translateStaticText.js:308
msgid ""
"CRCs are only displayed after plugins have been loaded, either by conflict "
"filtering, or by sorting."
msgstr ""
#: src/gui/html/js/translateStaticText.js:303
#: src/gui/html/js/translateStaticText.js:309
msgid ""
"Double-click a plugin in the sidebar to quickly open it in the metadata "
"editor."
msgstr ""
#: src/gui/html/js/translateStaticText.js:304
#: src/gui/html/js/translateStaticText.js:310
msgid ""
"Plugins can be drag and dropped from the sidebar into the metadata editor's "
"\"load after\", \"requirements\" and \"incompatibility\" tables."
msgstr ""
#: src/gui/html/js/translateStaticText.js:305
#: src/gui/html/js/translateStaticText.js:311
msgid ""
"Some features are disabled while the metadata editor is open, or while there "
"is a sorted load order that has not been applied or discarded."
msgstr ""
#: src/gui/html/js/translateStaticText.js:306
#: src/gui/html/js/translateStaticText.js:312
msgid ""
"Many interface elements have tooltips. If you don't know what something is, "
"try hovering your mouse over it to find out. Otherwise, LOOT's documentation "
"can be accessed through the main menu."
msgstr ""
#: src/gui/html/js/translateStaticText.js:314
#: src/gui/html/js/translateStaticText.js:326
#, javascript-format
msgid ""
"LOOT is free, but if you want to show your appreciation with some money, "
"donations may be made to WrinklyNinja (LOOT's creator and main developer) "
"using %s or %s."
msgstr ""
#: src/gui/html/js/translateStaticText.js:321
msgid "About LOOT"
msgstr ""
#: src/gui/html/js/translateStaticText.js:323
#, javascript-format
msgid "Version %s (build %s)"
msgstr ""
#: src/gui/html/js/translateStaticText.js:324
msgid ""
"Load order optimisation for Oblivion, Skyrim, Skyrim Special Edition, "
"Fallout 3, Fallout: New Vegas and Fallout 4."
msgstr ""
#: src/gui/query/get_game_data_query.h:44
msgid "Parsing, merging and evaluating metadata..."
msgstr ""
+2 -2
View File
@@ -350,7 +350,7 @@
exit-animation="fade-out-animation">
<h2>About LOOT</h2>
<paper-dialog-scrollable>
<p>Version <span id="LOOTVersion"></span> (build <span id="LOOTBuild"></span>)</p>
<p>Version unknown (build unknown)</p>
<p>Load order optimisation for Oblivion, Skyrim, Skyrim Special Edition, Fallout 3, Fallout: New Vegas and Fallout 4.</p>
<p><a href="https://loot.github.io">https://loot.github.io</a></p>
<p>LOOT is free, but if you want to show your appreciation with some money, donations may be made to WrinklyNinja (LOOT's creator and main developer) using <a href="https://www.paypal.me/OliverHamlet">PayPal</a> or <a href="https://wrinklyninja.github.io/bitcoin/">Bitcoin</a>.</p>
@@ -429,7 +429,7 @@
entry-animation="fade-in-animation"
exit-animation="fade-out-animation">
<h2>First-Time Tips</h2>
<p>This appears to be the first time you have run LOOT v<span id="firstTimeLootVersion"></span>. Here are some tips to help you get started with the interface.</p>
<p>This appears to be the first time you have run LOOT version unknown. Here are some tips to help you get started with the interface.</p>
<ul>
<li>Click <iron-icon icon="more-vert"></iron-icon> buttons to open menus.</li>
<li>As well as messages, LOOT displays plugin <span class="version">version numbers</span>, <span class="crc">CRCs</span> and Bash Tag suggestions for <span class="tag add">addition</span> and <span class="tag remove">removal</span>.</li>
-6
View File
@@ -192,12 +192,6 @@
document.getElementById('totalErrorNo').textContent = errorMessages.length;
}
static setVersion(version) {
document.getElementById('LOOTVersion').textContent = version.release;
document.getElementById('firstTimeLootVersion').textContent = version.release;
document.getElementById('LOOTBuild').textContent = version.build;
}
static onJumpToGeneralInfo() {
document.getElementById('pluginCardList').scroll(0, 0);
}
+4 -5
View File
@@ -121,8 +121,7 @@
function setVersion(appData) {
return query('getVersion').then(JSON.parse).then((version) => {
appData.version = version.release;
dom.setVersion(version);
appData.version = version;
});
}
@@ -203,7 +202,7 @@
});
setupEventHandlers();
loot.version = '';
loot.version = {};
loot.settings = {};
loot.l10n = new Translator();
loot.game = new Game({}, loot.l10n);
@@ -221,7 +220,7 @@
return loot.l10n.load();
}).then(() => {
loot.filters = new Filters(loot.l10n);
translateStaticText(loot.l10n);
translateStaticText(loot.l10n, loot.version);
/* Also need to update the settings UI. */
dom.updateSettingsDialog(loot.settings);
dom.setGameMenuItems(loot.settings.games);
@@ -233,7 +232,7 @@
.then(() => setGameData(loot))
.catch(handleInitErrors)
.then(() => {
if (loot.settings.lastVersion !== loot.version) {
if (loot.settings.lastVersion !== loot.version.release) {
dom.openDialog('firstRun');
}
})
+22 -3
View File
@@ -294,21 +294,39 @@
document.getElementById('settingsDialog').getElementsByClassName('cancel')[0].textContent = l10n.translate('Cancel');
}
function translateFirstRunDialog(l10n) {
function translateFirstRunDialog(l10n, version) {
/* First-run dialog */
const firstRun = document.getElementById('firstRun');
firstRun.querySelector('h2').textContent = l10n.translate('First-Time Tips');
firstRun.querySelector('p:first-of-type').innerHTML = l10n.translateFormatted('This appears to be the first time you have run LOOT v%s. Here are some tips to help you get started with the interface.', version.release);
firstRun.querySelector('li:nth-child(1)').innerHTML = l10n.translateFormatted('Click %(menu_icon)s buttons to open menus.', {
menu_icon: '<iron-icon icon="more-vert"></iron-icon>',
});
firstRun.querySelector('li:nth-child(2)').innerHTML = l10n.translate('As well as messages, LOOT displays plugin <span class="version">version numbers</span>, <span class="crc">CRCs</span> and Bash Tag suggestions for <span class="tag add">addition</span> and <span class="tag remove">removal</span>.');
firstRun.querySelector('li:nth-child(3)').textContent = l10n.translate('CRCs are only displayed after plugins have been loaded, either by conflict filtering, or by sorting.');
firstRun.querySelector('li:nth-child(4)').textContent = l10n.translate('Double-click a plugin in the sidebar to quickly open it in the metadata editor.');
firstRun.querySelector('li:nth-child(5)').textContent = l10n.translate('Plugins can be drag and dropped from the sidebar into the metadata editor\'s "load after", "requirements" and "incompatibility" tables.');
firstRun.querySelector('li:nth-child(6)').textContent = l10n.translate('Some features are disabled while the metadata editor is open, or while there is a sorted load order that has not been applied or discarded.');
firstRun.querySelector('li:last-child').textContent = l10n.translate('Many interface elements have tooltips. If you don\'t know what something is, try hovering your mouse over it to find out. Otherwise, LOOT\'s documentation can be accessed through the main menu.');
firstRun.querySelector('p:last-of-type').innerHTML = l10n.translateFormatted("LOOT is free, but if you want to show your appreciation with some money, donations may be made to WrinklyNinja (LOOT's creator and main developer) using %s or %s.", '<a href="https://www.paypal.me/OliverHamlet">PayPal</a>', '<a href="https://wrinklyninja.github.io/bitcoin/">Bitcoin</a>');
firstRun.getElementsByTagName('paper-button')[0].textContent = l10n.translate('OK');
}
return (l10n) => {
function translateAboutDialog(l10n, version) {
const about = document.getElementById('about');
about.querySelector('h2').textContent = l10n.translate('About LOOT');
about.querySelector('p:nth-child(1)').innerHTML = l10n.translateFormatted('Version %s (build %s)', version.release, version.build);
about.querySelector('p:nth-child(2)').textContent = l10n.translate('Load order optimisation for Oblivion, Skyrim, Skyrim Special Edition, Fallout 3, Fallout: New Vegas and Fallout 4.');
about.querySelector('p:nth-child(4)').innerHTML = l10n.translateFormatted("LOOT is free, but if you want to show your appreciation with some money, donations may be made to WrinklyNinja (LOOT's creator and main developer) using %s or %s.", '<a href="https://www.paypal.me/OliverHamlet">PayPal</a>', '<a href="https://wrinklyninja.github.io/bitcoin/">Bitcoin</a>');
}
return (l10n, version) => {
translatePluginCardTemplate(l10n);
translatePluginEditorTemplate(l10n);
translatePluginListItemTemplate(l10n);
@@ -328,6 +346,7 @@
translateSummaryCard(l10n);
translateSettingsDialog(l10n);
translateFirstRunDialog(l10n);
translateFirstRunDialog(l10n, version);
translateAboutDialog(l10n, version);
};
}));