summaryrefslogtreecommitdiffstats
path: root/modules-available/translation
diff options
context:
space:
mode:
authorSimon Rettberg2016-05-10 19:17:28 +0200
committerSimon Rettberg2016-05-10 19:17:28 +0200
commita79bbfa1a23838b91e9a08f7014c2c7304976714 (patch)
treefafb56190707d10b01cb282bc14b99156e100dcb /modules-available/translation
parentTranslating module strings and custom sections works (diff)
downloadslx-admin-a79bbfa1a23838b91e9a08f7014c2c7304976714.tar.gz
slx-admin-a79bbfa1a23838b91e9a08f7014c2c7304976714.tar.xz
slx-admin-a79bbfa1a23838b91e9a08f7014c2c7304976714.zip
Migrated messages to modules
Diffstat (limited to 'modules-available/translation')
-rw-r--r--modules-available/translation/lang/de/messages.json5
-rw-r--r--modules-available/translation/lang/de/template-tags.json3
-rw-r--r--modules-available/translation/lang/en/messages.json6
-rw-r--r--modules-available/translation/lang/en/template-tags.json2
-rw-r--r--modules-available/translation/lang/pt/messages.json4
-rw-r--r--modules-available/translation/page.inc.php27
-rw-r--r--modules-available/translation/templates/edit.html3
7 files changed, 42 insertions, 8 deletions
diff --git a/modules-available/translation/lang/de/messages.json b/modules-available/translation/lang/de/messages.json
index 645d678b..dbbef6b8 100644
--- a/modules-available/translation/lang/de/messages.json
+++ b/modules-available/translation/lang/de/messages.json
@@ -1,3 +1,6 @@
{
- "i18n-invalid-lang": "Ung\u00fcltige Sprache: {{0}}"
+ "i18n-invalid-lang": "Ung\u00fcltige Sprache: {{0}}",
+ "invalid-template": "Ausgew\u00e4hlte Template ist nicht g\u00fcltig",
+ "i18n-empty-tag": "Ein String wurde ohne Tag \u00fcbermittelt",
+ "updated-tags": "Tags wurden aktualisiert"
} \ No newline at end of file
diff --git a/modules-available/translation/lang/de/template-tags.json b/modules-available/translation/lang/de/template-tags.json
index 613a8fa1..9b4da6bd 100644
--- a/modules-available/translation/lang/de/template-tags.json
+++ b/modules-available/translation/lang/de/template-tags.json
@@ -9,6 +9,8 @@
"lang_editModules": "Modul bearbeiten",
"lang_editSettings": "Einstellungstexte bearbeiten",
"lang_editTemplates": "Template-Texte bearbeiten",
+ "lang_global": "Global",
+ "lang_globalTooltip": "Dieser Tag ist global verf\u00fcgbar und braucht normalerweise nicht explizit f\u00fcr dieses Modul \u00fcbersetzt zu werden",
"lang_hint": "Hinweis",
"lang_langAdministration": "Templates",
"lang_mainHeading": "\u00dcbersetzungen verwalten",
@@ -25,6 +27,7 @@
"lang_templateHint": "Hinweis: Gelbe Linie zeigt eine \u00dcbersetzung fehlt und roten Linien zeigen ein Tag wird nicht von das Template verwendet.",
"lang_templates": "Templates",
"lang_translation": "\u00dcbersetzung",
+ "lang_translationHeading": "Verwalten der \u00dcbersetzungen",
"lang_unused": "Ungenutzt",
"lang_unusedUnreliableHint": "Die Erkennung von ungenutzten Tags bezieht nur aktivierte Module mit ein. Es k\u00f6nnte sein, dass ein ungenutzt gemeldeter Tag in einem nicht aktivierten Modul verwendet wird."
} \ No newline at end of file
diff --git a/modules-available/translation/lang/en/messages.json b/modules-available/translation/lang/en/messages.json
new file mode 100644
index 00000000..84478fe9
--- /dev/null
+++ b/modules-available/translation/lang/en/messages.json
@@ -0,0 +1,6 @@
+{
+ "i18n-invalid-lang": "Invalid language: {{0}}",
+ "invalid-template": "Selected template is not valid",
+ "i18n-empty-tag": "A string without tag was submitted",
+ "updated-tags": "Tags have been updated"
+} \ No newline at end of file
diff --git a/modules-available/translation/lang/en/template-tags.json b/modules-available/translation/lang/en/template-tags.json
index 84b3ba26..1b5e6dc8 100644
--- a/modules-available/translation/lang/en/template-tags.json
+++ b/modules-available/translation/lang/en/template-tags.json
@@ -9,6 +9,8 @@
"lang_editModules": "Edit Module Translations",
"lang_editSettings": "Edit configuration variables related strings",
"lang_editTemplates": "Edit template strings",
+ "lang_global": "Global",
+ "lang_globalTooltip": "This tag is global; usually there is no need to translate it explicitly for this module",
"lang_hint": "Notice",
"lang_langAdministration": "Templates",
"lang_mainHeading": "Translation management",
diff --git a/modules-available/translation/lang/pt/messages.json b/modules-available/translation/lang/pt/messages.json
new file mode 100644
index 00000000..c3b38952
--- /dev/null
+++ b/modules-available/translation/lang/pt/messages.json
@@ -0,0 +1,4 @@
+{
+ "invalid-template": "Template selecionado n\u00e3o \u00e9 v\u00e1lido",
+ "updated-tags": "Tags foram atualizadas com sucesso"
+} \ No newline at end of file
diff --git a/modules-available/translation/page.inc.php b/modules-available/translation/page.inc.php
index 1713efe9..f3474acd 100644
--- a/modules-available/translation/page.inc.php
+++ b/modules-available/translation/page.inc.php
@@ -82,7 +82,7 @@ class Page_Translation extends Page
User::load();
if (!User::hasPermission('superadmin')) {
- Message::addError('no-permission');
+ Message::addError('main.no-permission');
Util::redirect('?do=Main');
}
@@ -299,10 +299,14 @@ class Page_Translation extends Page
$data = array(
'subsection' => $subsection,
'module' => $this->module->getIdentifier(),
- 'tagcount' => count($moduleTags),
+ 'tagcount' => $moduleTags === false ? '???' : count($moduleTags),
);
foreach (Dictionary::getLanguages(true) as $lang) {
- list($missing, $unused) = $this->getModuleTranslationStatus($lang['cc'], $subsection, false, $moduleTags);
+ if ($moduleTags !== false) {
+ list($missing, $unused) = $this->getModuleTranslationStatus($lang['cc'], $subsection, false, $moduleTags);
+ } else {
+ $missing = $unused = '???';
+ }
$data['langs'][] = array(
'cc' => $lang['cc'],
'name' => $lang['name'],
@@ -446,7 +450,7 @@ class Page_Translation extends Page
private function loadUsedCustomTags($subsection)
{
if (!isset($this->customHandler['grep_'.$subsection]))
- return array();
+ return false;
return $this->customHandler['grep_'.$subsection]($this->module);
}
@@ -512,7 +516,7 @@ class Page_Translation extends Page
}
foreach (array_keys($translation) as $key) {
if(!isset($tags[$key])) {
- if (!in_array($key, $globalTranslation)) {
+ if (!isset($globalTranslation[$key])) {
$unused++;
}
} else {
@@ -779,6 +783,11 @@ class Page_Translation extends Page
// For each tag, include a translated string from another language as reference
$this->findTranslationSamples($file, $tags);
}
+ if ($file === 'template-tags' || $file === 'module') {
+ $globals = Dictionary::getArray('main', 'global-tags', $this->destLang);
+ } else {
+ $globals = array();
+ }
$tagid = 0;
foreach ($tags as &$tag) {
$tag['tagid'] = $tagid++;
@@ -786,9 +795,13 @@ class Page_Translation extends Page
// We have a list of required tags, so mark those that are missing or unused
if (!isset($tag['required'])) {
$tag['unused'] = true;
- } elseif (!isset($tag['translation'])) {
+ } elseif (!isset($tag['translation']) && !isset($globals[$tag['tag']])) {
$tag['missing'] = true;
}
+ if (isset($globals[$tag['tag']])) {
+ $tag['isglobal'] = true;
+ $tag['placeholder'] = $globals[$tag['tag']];
+ }
}
}
// Finally remove tagname from the keys so mustache will iterate over them via {{#..}}
@@ -915,7 +928,7 @@ class Page_Translation extends Page
$json = up_json_encode($data, JSON_PRETTY_PRINT); // Also for better diffability of the json files, we pretty print
//exits the function in case the action was unsuccessful
if (file_put_contents($file, $json) === false) {
- Message::addError('error-write', $file);
+ Message::addError('main.error-write', $file);
return;
}
}
diff --git a/modules-available/translation/templates/edit.html b/modules-available/translation/templates/edit.html
index 3f3e926f..af176c03 100644
--- a/modules-available/translation/templates/edit.html
+++ b/modules-available/translation/templates/edit.html
@@ -31,6 +31,9 @@
{{#missing}}
<span class="label label-warning">{{lang_missing}}</span>
{{/missing}}
+ {{#isglobal}}
+ <span class="label label-success" title="{{lang_globalTooltip}}">{{lang_global}}</span>
+ {{/isglobal}}
{{tag}}
<div class="slx-notebox">{{{notes}}}</div>
</div>