summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorraul2014-08-08 16:54:59 +0200
committerraul2014-08-08 16:54:59 +0200
commitee50aef29ed2009c142da1e68b603489e6cb6116 (patch)
tree212ad75f42fe26b061216504557c48ccd56facda
parent[i18n]Add and remove options available for lang administration (diff)
downloadslx-admin-ee50aef29ed2009c142da1e68b603489e6cb6116.tar.gz
slx-admin-ee50aef29ed2009c142da1e68b603489e6cb6116.tar.xz
slx-admin-ee50aef29ed2009c142da1e68b603489e6cb6116.zip
[i18n] renamed, improved and commented the translation system
-rw-r--r--lang/de/administration/_page.json1
-rw-r--r--lang/de/administration/messages.json1
-rw-r--r--lang/de/administration/template.json1
-rw-r--r--lang/de/dialog-generic.json2
-rw-r--r--lang/de/main-menu-login.json2
-rw-r--r--lang/de/main-menu-logout.json2
-rw-r--r--lang/de/messages.json2
-rw-r--r--lang/de/page-minilinux.json4
-rw-r--r--lang/de/translation/_page.json1
-rw-r--r--lang/de/translation/messages.json1
-rw-r--r--lang/de/translation/template.json1
-rw-r--r--lang/en/administration/_page.json1
-rw-r--r--lang/en/administration/messages.json1
-rw-r--r--lang/en/administration/template.json1
-rw-r--r--lang/en/dialog-generic.json2
-rw-r--r--lang/en/main-menu-login.json2
-rw-r--r--lang/en/main-menu-logout.json2
-rw-r--r--lang/en/messages.json2
-rw-r--r--lang/en/page-minilinux.json4
-rw-r--r--lang/en/translation/_page.json1
-rw-r--r--lang/en/translation/messages.json1
-rw-r--r--lang/en/translation/template.json1
-rw-r--r--lang/i18n.php13
-rw-r--r--lang/pt/administration/template.json1
-rw-r--r--lang/pt/dialog-generic.json2
-rw-r--r--lang/pt/main-menu-login.json2
-rw-r--r--lang/pt/main-menu-logout.json2
-rw-r--r--lang/pt/messages.json2
-rw-r--r--lang/pt/page-minilinux.json4
-rw-r--r--lang/pt/translation/_page.json (renamed from lang/pt/administration/_page.json)0
-rw-r--r--lang/pt/translation/messages.json (renamed from lang/pt/administration/messages.json)2
-rw-r--r--lang/pt/translation/template.json1
-rw-r--r--modules/translation.inc.php (renamed from modules/admin.inc.php)158
-rw-r--r--templates/translation/_page.html (renamed from templates/administration/_page.html)10
-rw-r--r--templates/translation/messages.html (renamed from templates/administration/messages.html)21
-rw-r--r--templates/translation/template.html (renamed from templates/administration/template.html)15
36 files changed, 182 insertions, 87 deletions
diff --git a/lang/de/administration/_page.json b/lang/de/administration/_page.json
deleted file mode 100644
index 90abe51c..00000000
--- a/lang/de/administration/_page.json
+++ /dev/null
@@ -1 +0,0 @@
-{"lang_langAdministration":"Sprache Verwaltung","lang_adminInfo":"","lang_editMessages":"Nachrichten bearbeiten","lang_german":"Deutsch","lang_english":"Englisch","lang_portuguese":"Portuguiesisch"} \ No newline at end of file
diff --git a/lang/de/administration/messages.json b/lang/de/administration/messages.json
deleted file mode 100644
index 03049639..00000000
--- a/lang/de/administration/messages.json
+++ /dev/null
@@ -1 +0,0 @@
-{"lang_messages":"","lang_templateMessagesHelp":"","lang_germanJSON":"","lang_englishJSON":"","lang_portugueseJSON":"","lang_germanTAG":"","lang_englishTAG":"","lang_portugueseTAG":"","lang_back":"","lang_newTag":"","lang_update":"Hochladen","lang_messagesHardcoded":"","lang_newTAG":"","lang_deleteTAG":"L\u00f6schen"} \ No newline at end of file
diff --git a/lang/de/administration/template.json b/lang/de/administration/template.json
deleted file mode 100644
index 2debb41d..00000000
--- a/lang/de/administration/template.json
+++ /dev/null
@@ -1 +0,0 @@
-{"lang_templateAdminHelp":"","lang_germanJSON":"","lang_englishJSON":"Englisch JSON","lang_portugueseJSON":"Portugiesisch JSON","lang_germanTAG":"","lang_englishTAG":"","lang_portugueseTAG":"Portugiesisch TAG","lang_back":"Z\u00fcruck","lang_update":"Hochladen","lang_createTag":"","lang_newTAG":"","lang_deleteTAG":"L\u00f6schen"} \ No newline at end of file
diff --git a/lang/de/dialog-generic.json b/lang/de/dialog-generic.json
index a033a102..d739a493 100644
--- a/lang/de/dialog-generic.json
+++ b/lang/de/dialog-generic.json
@@ -1 +1 @@
-{"lang_notUsed":"","lang_next":"Weiter"} \ No newline at end of file
+{"lang_next":"Weiter"} \ No newline at end of file
diff --git a/lang/de/main-menu-login.json b/lang/de/main-menu-login.json
index adb2d053..398b8b6c 100644
--- a/lang/de/main-menu-login.json
+++ b/lang/de/main-menu-login.json
@@ -1 +1 @@
-{"lang_clientLog":"Client Log","lang_settings":"Einstellungen","lang_client":"Client","lang_localization":"Lokalisierung","lang_configurationVariables":"KonfigurationsVariablen","lang_administration":"Verwaltung","lang_server":"Server","lang_configurationBasic":"Grundkonfiguration","lang_vmLocation":"VM Speicherort","lang_news":"News","lang_language":"Sprachen","lang_login":"Anmelden"} \ No newline at end of file
+{"lang_clientLog":"Client Log","lang_settings":"Einstellungen","lang_client":"Client","lang_localization":"Lokalisierung","lang_configurationVariables":"KonfigurationsVariablen","lang_administration":"\u00dcbersetzungen","lang_server":"Server","lang_configurationBasic":"Grundkonfiguration","lang_vmLocation":"VM Speicherort","lang_news":"News","lang_language":"Sprachen","lang_login":"Anmelden"} \ No newline at end of file
diff --git a/lang/de/main-menu-logout.json b/lang/de/main-menu-logout.json
index 2b1088b8..4e3bcf90 100644
--- a/lang/de/main-menu-logout.json
+++ b/lang/de/main-menu-logout.json
@@ -1 +1 @@
-{"lang_clientLog":"Client Log","lang_settings":"Einstellungen","lang_client":"Client","lang_localization":"Lokalisierung","lang_configurationVariables":"KonfigurationsVariablen","lang_administration":"Verwaltung","lang_server":"Server","lang_configurationBasic":"Grundkonfiguration","lang_vmLocation":"VM Speicherort","lang_news":"News","lang_language":"Sprachen","lang_logout":"Abmelden"} \ No newline at end of file
+{"lang_clientLog":"Client Log","lang_settings":"Einstellungen","lang_client":"Client","lang_localization":"Lokalisierung","lang_configurationVariables":"KonfigurationsVariablen","lang_administration":"\u00dcbersetzungen","lang_server":"Server","lang_configurationBasic":"Grundkonfiguration","lang_vmLocation":"VM Speicherort","lang_news":"News","lang_language":"Sprachen","lang_logout":"Abmelden"} \ No newline at end of file
diff --git a/lang/de/messages.json b/lang/de/messages.json
index c01b2a72..0221ad8e 100644
--- a/lang/de/messages.json
+++ b/lang/de/messages.json
@@ -1 +1 @@
-{"loginfail":"Benutzername oder Kennwort falsch","token":"Ung\u00fcltiges Token. CSRF Angriff?","adduser-disabled":"Keine ausreichenden Rechte, um weitere Benutzer hinzuzuf\u00fcgen","password-mismatch":"Passwort und Passwortbest\u00e4tigung stimmen nicht \u00fcberein","empty-field":"Ein Feld wurde nicht ausgef\u00fcllt","adduser-success":"Benutzer erfolgreich hinzugef\u00fcgt","no-permission":"Keine ausreichenden Rechte, um auf diese Seite zuzugreifen","settings-updated":"Einstellungen wurden aktualisiert","debug-mode":"Der Debug-Modus ist aktiv!","value-invalid":"Der Wert {{1}} ist ung\u00fcltig f\u00fcr die Option {{0}} und wurde ignoriert","invalid-action":"Ung\u00fcltige Aktion: {{0}}","remote-timeout":"Konnte Ressource {{0}} nicht herunterladen ({{1}})","remote-parse-failed":"Parsen der empfangenen Daten fehlgeschlagen ({{0}})","missing-file":"Es wurde keine Datei ausgew\u00e4hlt!","invalid-file":"Die Datei {{0}} existiert nicht!","upload-complete":"Upload von {{0}} war erfolgreich","upload-failed":"Upload schlug fehl: {{0}}","config-activated":"Konfiguration {{0}} wurde aktiviert","config-invalid":"Konfiguration mit ID {{0}} existiert nicht","error-write":"Fehler beim Schreiben von {{0}}","error-read":"Fehler beim Lesen von {{0}}","error-archive":"Korruptes Archiv oder nicht unterst\u00fctztes Format","error-rename":"Konnte {{0}} nicht in {{1}} umbenennen","error-nodir":"Das Verzeichnis {{0}} existiert nicht.","empty-archive":"Das Archiv enth\u00e4lt keine Dateien oder Verzeichnisse","error-extract":"Konnte Archiv nicht nach {{0}} entpacken - {{1}}","module-added":"Modul erfolgreich hinzugef\u00fcgt","module-deleted":"Modul {{0}} wurde gel\u00f6scht","module-in-use":"Modul {{0}} wird noch durch Konfiguration {{1}} verwendet","taskmanager-error":"Verbindung zum Taskmanager fehlgeschlagen","taskmanager-format":"Taskmanager hat ung\u00fcltige Daten zur\u00fcckgeliefert","task-error":"Ausf\u00fchrung fehlgeschlagen: {{0}}","invalid-ip":"Kein Interface ist auf die Adresse {{0}} konfiguriert","news-save-success":"News erfolgreich aktualisiert","news-empty":"Es wurde keine News in der Datenbank gefunden","news-del-success":"News gel\u00f6scht","reboot-unconfirmed":"Sicherheitsabfrage zum Reboot nicht best\u00e4tigt","invalid-template":"Ausgew\u00e4hlte Template ist nicht g\u00fcltig","deleted-tag":"","updated-tags":""} \ No newline at end of file
+{"loginfail":"Benutzername oder Kennwort falsch","token":"Ung\u00fcltiges Token. CSRF Angriff?","adduser-disabled":"Keine ausreichenden Rechte, um weitere Benutzer hinzuzuf\u00fcgen","password-mismatch":"Passwort und Passwortbest\u00e4tigung stimmen nicht \u00fcberein","empty-field":"Ein Feld wurde nicht ausgef\u00fcllt","adduser-success":"Benutzer erfolgreich hinzugef\u00fcgt","no-permission":"Keine ausreichenden Rechte, um auf diese Seite zuzugreifen","settings-updated":"Einstellungen wurden aktualisiert","debug-mode":"Der Debug-Modus ist aktiv!","value-invalid":"Der Wert {{1}} ist ung\u00fcltig f\u00fcr die Option {{0}} und wurde ignoriert","invalid-action":"Ung\u00fcltige Aktion: {{0}}","remote-timeout":"Konnte Ressource {{0}} nicht herunterladen ({{1}})","remote-parse-failed":"Parsen der empfangenen Daten fehlgeschlagen ({{0}})","missing-file":"Es wurde keine Datei ausgew\u00e4hlt!","invalid-file":"Die Datei {{0}} existiert nicht!","upload-complete":"Upload von {{0}} war erfolgreich","upload-failed":"Upload schlug fehl: {{0}}","config-activated":"Konfiguration {{0}} wurde aktiviert","config-invalid":"Konfiguration mit ID {{0}} existiert nicht","error-write":"Fehler beim Schreiben von {{0}}","error-read":"Fehler beim Lesen von {{0}}","error-archive":"Korruptes Archiv oder nicht unterst\u00fctztes Format","error-rename":"Konnte {{0}} nicht in {{1}} umbenennen","error-nodir":"Das Verzeichnis {{0}} existiert nicht.","empty-archive":"Das Archiv enth\u00e4lt keine Dateien oder Verzeichnisse","error-extract":"Konnte Archiv nicht nach {{0}} entpacken - {{1}}","module-added":"Modul erfolgreich hinzugef\u00fcgt","module-deleted":"Modul {{0}} wurde gel\u00f6scht","module-in-use":"Modul {{0}} wird noch durch Konfiguration {{1}} verwendet","taskmanager-error":"Verbindung zum Taskmanager fehlgeschlagen","taskmanager-format":"Taskmanager hat ung\u00fcltige Daten zur\u00fcckgeliefert","task-error":"Ausf\u00fchrung fehlgeschlagen: {{0}}","invalid-ip":"Kein Interface ist auf die Adresse {{0}} konfiguriert","news-save-success":"News erfolgreich aktualisiert","news-empty":"Es wurde keine News in der Datenbank gefunden","news-del-success":"News gel\u00f6scht","reboot-unconfirmed":"Sicherheitsabfrage zum Reboot nicht best\u00e4tigt","invalid-template":"Ausgew\u00e4hlte Template ist nicht g\u00fcltig","deleted-tag":"","updated-tags":"","unsuccessful-action":""} \ No newline at end of file
diff --git a/lang/de/page-minilinux.json b/lang/de/page-minilinux.json
index c8a965b1..015cf4c7 100644
--- a/lang/de/page-minilinux.json
+++ b/lang/de/page-minilinux.json
@@ -1,3 +1 @@
-{
- "lang_listObtained":"Liste wird abgerufen..."
-}
+{"lang_listObtained":"Liste wird abgerufen...","lang_errorGetting":""} \ No newline at end of file
diff --git a/lang/de/translation/_page.json b/lang/de/translation/_page.json
new file mode 100644
index 00000000..da3733cb
--- /dev/null
+++ b/lang/de/translation/_page.json
@@ -0,0 +1 @@
+{"lang_langAdministration":"Sprache Verwaltung","lang_adminInfo":"In diesem Abschnitt k\u00f6nnen Sie die JSON-Tags, die \u00fcbersetzten Texte durch die Website verwendet wird, enth\u00e4lt zu \u00e4ndern. Um dies zu tun, w\u00e4hlen Sie eine Vorlage aus, um ihre jeweiligen Tags \u00e4ndern. Alternativ klicken Sie auf den Link unten, um die Nachrichten der Website \u00e4ndern.","lang_editMessages":"Nachrichten bearbeiten","lang_german":"Deutsch","lang_english":"Englisch","lang_portuguese":"Portuguiesisch"} \ No newline at end of file
diff --git a/lang/de/translation/messages.json b/lang/de/translation/messages.json
new file mode 100644
index 00000000..231f3a98
--- /dev/null
+++ b/lang/de/translation/messages.json
@@ -0,0 +1 @@
+{"lang_messages":"Nachrichten","lang_templateMessagesHelp":"","lang_germanJSON":"Deutsch JSON","lang_englishJSON":"Englisch JSON","lang_portugueseJSON":"Portugiesisch JSON","lang_germanTAG":"Deutsch TAG","lang_englishTAG":"Englisch TAG","lang_portugueseTAG":"Portugiesisch TAG","lang_back":"Z\u00fcruck","lang_newTag":"Neue Nachricht","lang_messagesHardcoded":"Hardcoded Nachrichten","lang_newTAG":"Neuer Tag","lang_deleteTAG":"L\u00f6schen","lang_templateHint":"Hinweis: Gelbe Linien zeigen eine \u00dcbersetzung fehlt und roten Linien zeigen ein Tag wird nicht von der Vorlage verwendet.","lang_save":"Speichern"} \ No newline at end of file
diff --git a/lang/de/translation/template.json b/lang/de/translation/template.json
new file mode 100644
index 00000000..ceb292e8
--- /dev/null
+++ b/lang/de/translation/template.json
@@ -0,0 +1 @@
+{"lang_templateAdminHelp":"","lang_germanJSON":"Deutsch JSON","lang_englishJSON":"Englisch JSON","lang_portugueseJSON":"Portugiesisch JSON","lang_germanTAG":"Deutsch TAG","lang_englishTAG":"Englisch TAG","lang_portugueseTAG":"Portugiesisch TAG","lang_back":"Z\u00fcruck","lang_createTag":"TAG schafen","lang_newTAG":"Neue Tag","lang_deleteTAG":"L\u00f6schen","lang_templateHint":"Hinweis: Gelbe Linie zeigt eine \u00dcbersetzung fehlt und roten Linien zeigen ein Tag wird nicht von das Template verwendet.","lang_save":"Speichern"} \ No newline at end of file
diff --git a/lang/en/administration/_page.json b/lang/en/administration/_page.json
deleted file mode 100644
index 41a2d901..00000000
--- a/lang/en/administration/_page.json
+++ /dev/null
@@ -1 +0,0 @@
-{"lang_langAdministration":"Language Administration","lang_adminInfo":"","lang_editMessages":"Edit Messages","lang_german":"German","lang_english":"English","lang_portuguese":"Portuguese"} \ No newline at end of file
diff --git a/lang/en/administration/messages.json b/lang/en/administration/messages.json
deleted file mode 100644
index 1b89873a..00000000
--- a/lang/en/administration/messages.json
+++ /dev/null
@@ -1 +0,0 @@
-{"lang_messages":"Messages","lang_templateMessagesHelp":"","lang_germanJSON":"German JSON","lang_englishJSON":"","lang_portugueseJSON":"","lang_germanTAG":"","lang_englishTAG":"","lang_portugueseTAG":"","lang_back":"","lang_newTag":"","lang_update":"Upload","lang_messagesHardcoded":"","lang_newTAG":"","lang_deleteTAG":"Delete"} \ No newline at end of file
diff --git a/lang/en/administration/template.json b/lang/en/administration/template.json
deleted file mode 100644
index 6ed52450..00000000
--- a/lang/en/administration/template.json
+++ /dev/null
@@ -1 +0,0 @@
-{"lang_templateAdminHelp":"","lang_germanJSON":"German JSON","lang_englishJSON":"","lang_portugueseJSON":"German JSON","lang_germanTAG":"German TAG","lang_englishTAG":"English TAG","lang_portugueseTAG":"Portuguese TAG","lang_back":"Back","lang_update":"Update","lang_createTag":"","lang_newTAG":"","lang_deleteTAG":"Delete"} \ No newline at end of file
diff --git a/lang/en/dialog-generic.json b/lang/en/dialog-generic.json
index 094fe1a1..c44e40a5 100644
--- a/lang/en/dialog-generic.json
+++ b/lang/en/dialog-generic.json
@@ -1 +1 @@
-{"lang_notUsed":"","lang_next":"Next"} \ No newline at end of file
+{"lang_next":"Next"} \ No newline at end of file
diff --git a/lang/en/main-menu-login.json b/lang/en/main-menu-login.json
index 0bb870f0..099cfe54 100644
--- a/lang/en/main-menu-login.json
+++ b/lang/en/main-menu-login.json
@@ -1 +1 @@
-{"lang_clientLog":"Client Log","lang_settings":"Settings","lang_client":"Client","lang_localization":"Localization","lang_configurationVariables":"Configuration Variables","lang_administration":"Administration","lang_server":"Server","lang_configurationBasic":"Basic Configuration","lang_vmLocation":"VM Location","lang_news":"News","lang_language":"Language","lang_login":"Login"} \ No newline at end of file
+{"lang_clientLog":"Client Log","lang_settings":"Settings","lang_client":"Client","lang_localization":"Localization","lang_configurationVariables":"Configuration Variables","lang_administration":"Translations","lang_server":"Server","lang_configurationBasic":"Basic Configuration","lang_vmLocation":"VM Location","lang_news":"News","lang_language":"Language","lang_login":"Login"} \ No newline at end of file
diff --git a/lang/en/main-menu-logout.json b/lang/en/main-menu-logout.json
index 41e6c426..94e99d90 100644
--- a/lang/en/main-menu-logout.json
+++ b/lang/en/main-menu-logout.json
@@ -1 +1 @@
-{"lang_clientLog":"Client Log","lang_settings":"Settings","lang_client":"Client","lang_localization":"Localization","lang_configurationVariables":"Configuration Variables","lang_administration":"Administration","lang_server":"Server","lang_configurationBasic":"Basic Configuration","lang_vmLocation":"VM Location","lang_news":"News","lang_language":"Language","lang_logout":"Logout"} \ No newline at end of file
+{"lang_clientLog":"Client Log","lang_settings":"Settings","lang_client":"Client","lang_localization":"Localization","lang_configurationVariables":"Configuration Variables","lang_administration":"Translations","lang_server":"Server","lang_configurationBasic":"Basic Configuration","lang_vmLocation":"VM Location","lang_news":"News","lang_language":"Language","lang_logout":"Logout"} \ No newline at end of file
diff --git a/lang/en/messages.json b/lang/en/messages.json
index 0d80283c..353f94c1 100644
--- a/lang/en/messages.json
+++ b/lang/en/messages.json
@@ -1 +1 @@
-{"loginfail":"Username or Password incorrect","token":"Invalid token. CSRF attack?","adduser-disabled":"Insufficient privileges to add more users","password-mismatch":"Password and password confirmation do not match","empty-field":"A field was not filled","adduser-success":"User successfully added","no-permission":"No sufficient privileges to access this page","settings-updated":"Settings have been updated","debug-mode":"The debug mode is active!","value-invalid":"The value {{1}} is invalid for option {{0}} and has been ignored","invalid-action":"Invalid action: {{0}}","remote-timeout":"Could not download resource {{0}} ({{1}})","remote-parse-failed":"Parsing the received data failed ({{0}})","missing-file":"There was no file selected!","invalid-file":"The file {{0}} does not exist!","upload-complete":"Upload of {{0}} was successful","upload-failed":"Upload failed: {{0}}","config-activated":"Configuration {{0}} has been activated","config-invalid":"Configuration with id {{0}} does not exist","error-write":"Failed to write {{0}}","error-read":"Error reading {{0}}","error-archive":"Corrupted archive or unsupported format","error-rename":"Could not rename {{0}} into {{1}}","error-nodir":"The directory {{0}} does not exist.","empty-archive":"The archive contains no files or directories","error-extract":"Could not unpack archive {{0}} to {{1}}","module-added":"Module successfully added","module-deleted":"Module {{0}} was deleted","module-in-use":"Module {{0}} is still used by Configuration {{1}}","taskmanager-error":"Failed to connect to the Task Manager","taskmanager-format":"Task Manager has returned invalid data","task-error":"Execution failed: {{0}}","invalid-ip":"No interface is configured with the address {{0}}","news-save-success":"News updated successfully","news-empty":"There was no news found in the database","news-del-success":"News deleted","reboot-unconfirmed":"Confirmation prompt to reboot not confirmed","invalid-template":"Selected template is not valid","deleted-tag":"","updated-tags":""} \ No newline at end of file
+{"loginfail":"Username or Password incorrect","token":"Invalid token. CSRF attack?","adduser-disabled":"Insufficient privileges to add more users","password-mismatch":"Password and password confirmation do not match","empty-field":"A field was not filled","adduser-success":"User successfully added","no-permission":"No sufficient privileges to access this page","settings-updated":"Settings have been updated","debug-mode":"The debug mode is active!","value-invalid":"The value {{1}} is invalid for option {{0}} and has been ignored","invalid-action":"Invalid action: {{0}}","remote-timeout":"Could not download resource {{0}} ({{1}})","remote-parse-failed":"Parsing the received data failed ({{0}})","missing-file":"There was no file selected!","invalid-file":"The file {{0}} does not exist!","upload-complete":"Upload of {{0}} was successful","upload-failed":"Upload failed: {{0}}","config-activated":"Configuration {{0}} has been activated","config-invalid":"Configuration with id {{0}} does not exist","error-write":"Failed to write {{0}}","error-read":"Error reading {{0}}","error-archive":"Corrupted archive or unsupported format","error-rename":"Could not rename {{0}} into {{1}}","error-nodir":"The directory {{0}} does not exist.","empty-archive":"The archive contains no files or directories","error-extract":"Could not unpack archive {{0}} to {{1}}","module-added":"Module successfully added","module-deleted":"Module {{0}} was deleted","module-in-use":"Module {{0}} is still used by Configuration {{1}}","taskmanager-error":"Failed to connect to the Task Manager","taskmanager-format":"Task Manager has returned invalid data","task-error":"Execution failed: {{0}}","invalid-ip":"No interface is configured with the address {{0}}","news-save-success":"News updated successfully","news-empty":"There was no news found in the database","news-del-success":"News deleted","reboot-unconfirmed":"Confirmation prompt to reboot not confirmed","invalid-template":"Selected template is not valid","deleted-tag":"Tag was successfully removed","updated-tags":"","unsuccessful-action":""} \ No newline at end of file
diff --git a/lang/en/page-minilinux.json b/lang/en/page-minilinux.json
index 2841f528..2ec6123c 100644
--- a/lang/en/page-minilinux.json
+++ b/lang/en/page-minilinux.json
@@ -1,3 +1 @@
-{
- "lang_listObtained":"List is being obtained..."
-}
+{"lang_listObtained":"List is being obtained...","lang_errorGetting":""} \ No newline at end of file
diff --git a/lang/en/translation/_page.json b/lang/en/translation/_page.json
new file mode 100644
index 00000000..f2b82119
--- /dev/null
+++ b/lang/en/translation/_page.json
@@ -0,0 +1 @@
+{"lang_langAdministration":"Language Administration","lang_adminInfo":"In this section you can change the JSON tags that contains the translated texts used by the site. To do this, select a template below to modify their respective tags. Alternatively, click the link below to change the messages of the site.","lang_editMessages":"Edit Messages","lang_german":"German","lang_english":"English","lang_portuguese":"Portuguese"} \ No newline at end of file
diff --git a/lang/en/translation/messages.json b/lang/en/translation/messages.json
new file mode 100644
index 00000000..4762d6d6
--- /dev/null
+++ b/lang/en/translation/messages.json
@@ -0,0 +1 @@
+{"lang_messages":"Messages","lang_templateMessagesHelp":"","lang_germanJSON":"German JSON","lang_englishJSON":"English JSON","lang_portugueseJSON":"German JSON","lang_germanTAG":"German TAG","lang_englishTAG":"English TAG","lang_portugueseTAG":"Portuguese TAG","lang_back":"Back","lang_newTag":"New Tag","lang_messagesHardcoded":"Hardcoded Messages","lang_newTAG":"New TAG","lang_deleteTAG":"Delete","lang_templateHint":"Hint: Yellow lines indicate a translation is missing and red lines indicate a tag is not being used by the template.","lang_save":"Save"} \ No newline at end of file
diff --git a/lang/en/translation/template.json b/lang/en/translation/template.json
new file mode 100644
index 00000000..cf707b5f
--- /dev/null
+++ b/lang/en/translation/template.json
@@ -0,0 +1 @@
+{"lang_templateAdminHelp":"","lang_germanJSON":"German JSON","lang_englishJSON":"English JSON","lang_portugueseJSON":"German JSON","lang_germanTAG":"German TAG","lang_englishTAG":"English TAG","lang_portugueseTAG":"Portuguese TAG","lang_back":"Back","lang_createTag":"Create TAG","lang_newTAG":"New TAG","lang_deleteTAG":"Delete","lang_templateHint":"Hint: Yellow lines indicate a translation is missing and red lines indicate a tag is not being used by the template.","lang_save":"Save"} \ No newline at end of file
diff --git a/lang/i18n.php b/lang/i18n.php
index 1f7731f2..a77efdcb 100644
--- a/lang/i18n.php
+++ b/lang/i18n.php
@@ -3,27 +3,32 @@
class Dictionary{
private static $messageArray;
+ //loads the messages and store them in the class
function build(){
self::$messageArray = json_decode(file_get_contents("lang/" . LANG . "/messages.json"),true);
}
+ //return an array with the JSON tags from the user's language or a specified language
public static function getArrayTemplate($template,$lang = false){
$language = array('lang'=>LANG);
- if(!$lang)
- return array_merge($language,json_decode(file_get_contents("lang/" . LANG . "/" . $template . ".json"),true));
+ if(!$lang) $lang = LANG;
return array_merge($language,json_decode(file_get_contents("lang/" . $lang . "/" . $template . ".json"),true));
}
-
+
+ //translate a hardcoded message
public static function translate($string){
$hardcoded = json_decode(file_get_contents("lang/" . LANG . "/messages-hardcoded.json"),true);
return $hardcoded[$string];
}
-
+
+ //returns an array with the JSON message tags
public static function getMessages(){
return self::$messageArray;
}
}
+
+
//Array containing the allowed languages for the website
$langArray = unserialize(SITE_LANGUAGES);
diff --git a/lang/pt/administration/template.json b/lang/pt/administration/template.json
deleted file mode 100644
index 8042342f..00000000
--- a/lang/pt/administration/template.json
+++ /dev/null
@@ -1 +0,0 @@
-{"lang_templateAdminHelp":"","lang_germanJSON":"JSON Alem\u00e3o","lang_englishJSON":"JSON Ingl\u00eas","lang_portugueseJSON":"JSON Portugu\u00eas","lang_germanTAG":"TAG em Alem\u00e3o","lang_englishTAG":"TAG em Ingl\u00eas","lang_portugueseTAG":"TAG em Portugu\u00eas","lang_back":"Voltar","lang_update":"Carregar","lang_createTag":"Criar TAG","lang_newTAG":"Nova TAG","lang_deleteTAG":"Excluir"} \ No newline at end of file
diff --git a/lang/pt/dialog-generic.json b/lang/pt/dialog-generic.json
index e6b73911..4bfb1624 100644
--- a/lang/pt/dialog-generic.json
+++ b/lang/pt/dialog-generic.json
@@ -1 +1 @@
-{"lang_notUsed":"","lang_next":"Pr\u00f3ximo"} \ No newline at end of file
+{"lang_next":"Pr\u00f3ximo"} \ No newline at end of file
diff --git a/lang/pt/main-menu-login.json b/lang/pt/main-menu-login.json
index feab29f1..0d539c6a 100644
--- a/lang/pt/main-menu-login.json
+++ b/lang/pt/main-menu-login.json
@@ -1 +1 @@
-{"lang_clientLog":"Log dos Clientes","lang_settings":"Op\u00e7\u00f5es","lang_client":"Cliente","lang_localization":"Localiza\u00e7\u00e3o","lang_configurationVariables":"Vari\u00e1veis de Configura\u00e7\u00e3o","lang_administration":"Administra\u00e7\u00e3o","lang_server":"Servidor","lang_configurationBasic":"Comfigura\u00e7\u00e3o B\u00e1sica","lang_vmLocation":"Localiza\u00e7\u00e3o da VM","lang_news":"Novidades","lang_language":"L\u00edngua","lang_login":"Entrar"} \ No newline at end of file
+{"lang_clientLog":"Log dos Clientes","lang_settings":"Op\u00e7\u00f5es","lang_client":"Cliente","lang_localization":"Localiza\u00e7\u00e3o","lang_configurationVariables":"Vari\u00e1veis de Configura\u00e7\u00e3o","lang_administration":"Tradu\u00e7\u00f5es","lang_server":"Servidor","lang_configurationBasic":"Comfigura\u00e7\u00e3o B\u00e1sica","lang_vmLocation":"Localiza\u00e7\u00e3o da VM","lang_news":"Novidades","lang_language":"L\u00edngua","lang_login":"Entrar"} \ No newline at end of file
diff --git a/lang/pt/main-menu-logout.json b/lang/pt/main-menu-logout.json
index 13ddfa15..9b2d985a 100644
--- a/lang/pt/main-menu-logout.json
+++ b/lang/pt/main-menu-logout.json
@@ -1 +1 @@
-{"lang_clientLog":"Log dos Clientes","lang_settings":"Op\u00e7\u00f5es","lang_client":"Cliente","lang_localization":"Localiza\u00e7\u00e3o","lang_configurationVariables":"Vari\u00e1veis de Configura\u00e7\u00e3o","lang_administration":"Administra\u00e7\u00e3o","lang_server":"Servidor","lang_configurationBasic":"Comfigura\u00e7\u00e3o B\u00e1sica","lang_vmLocation":"Localiza\u00e7\u00e3o da VM","lang_news":"Novidades","lang_language":"L\u00edngua","lang_logout":"Sair"} \ No newline at end of file
+{"lang_clientLog":"Log dos Clientes","lang_settings":"Op\u00e7\u00f5es","lang_client":"Cliente","lang_localization":"Localiza\u00e7\u00e3o","lang_configurationVariables":"Vari\u00e1veis de Configura\u00e7\u00e3o","lang_administration":"Tradu\u00e7\u00f5es","lang_server":"Servidor","lang_configurationBasic":"Comfigura\u00e7\u00e3o B\u00e1sica","lang_vmLocation":"Localiza\u00e7\u00e3o da VM","lang_news":"Novidades","lang_language":"L\u00edngua","lang_logout":"Sair"} \ No newline at end of file
diff --git a/lang/pt/messages.json b/lang/pt/messages.json
index 3033fdb8..44224bc5 100644
--- a/lang/pt/messages.json
+++ b/lang/pt/messages.json
@@ -1 +1 @@
-{"loginfail":"Nome de usu\u00e1rio ou senha incorreta","token":"Token inv\u00e1lido. Ataque CSRF?","adduser-disabled":"Privil\u00e9gios insuficientes para adicionar mais usu\u00e1rios","password-mismatch":"Senha e confirma\u00e7\u00e3o de senha n\u00e3o s\u00e3o iguais","empty-field":"Um campo n\u00e3o foi preenchido","adduser-success":"Usu\u00e1rio adicionado com sucesso","no-permission":"N\u00e3o h\u00e1 privil\u00e9gios suficientes para acessar essa p\u00e1gina","settings-updated":"As configura\u00e7\u00f5es foram atualizadas","debug-mode":"O modo de depura\u00e7\u00e3o est\u00e1 ativo!","value-invalid":"O valor {{1}} \u00e9 inv\u00e1lido para op\u00e7\u00e3o {{0}} e foi ignorado","invalid-action":"A\u00e7\u00e3o inv\u00e1lida: {{0}}","remote-timeout":"N\u00e3o foi poss\u00edvel baixar o recurso {{0}} ({{1}})","remote-parse-failed":"An\u00e1lise dos dados recebidos falhou ({{0}})","missing-file":"N\u00e3o havia nenhum arquivo selecionado!","invalid-file":"O arquivo {{0}} n\u00e3o existe!","upload-complete":"Envio de {{0}} foi bem sucedido","upload-failed":"Envio falhou: {{0}}","config-activated":"Configura\u00e7\u00e3o {{0}} foi ativada","config-invalid":"Configura\u00e7\u00e3o com id {{0}} n\u00e3o existe","error-write":"Erro ao escrever {{0}}","error-read":"Erro ao ler {{0}}","error-archive":"Arquivo corrompido ou formato n\u00e3o suportado","error-rename":"N\u00e3o foi poss\u00edvel renomear {{0}} em {{1}}","error-nodir":"O diret\u00f3rio {{0}} n\u00e3o existe.","empty-archive":"O arquivo n\u00e3o cont\u00e9m arquivos ou diret\u00f3rios","error-extract":"N\u00e3o foi poss\u00edvel descompactar arquivo {{0}} para {{1}}","module-added":"M\u00f3dulo adicionado com sucesso","module-deleted":"M\u00f3dulo {{0}} foi exclu\u00eddo","module-in-use":"M\u00f3dulo {{0}} ainda \u00e9 usado pela configura\u00e7\u00e3o {{1}}","taskmanager-error":"Falha ao conectar-se ao Gerenciador de Tarefas","taskmanager-format":"Gerenciador de Tarefas retornou dados inv\u00e1lidos","task-error":"Falha na execu\u00e7\u00e3o: {{0}}","invalid-ip":"Nenhuma interface est\u00e1 configurada com o endere\u00e7o {{0}}","news-save-success":"Not\u00edcia atualizada com sucesso","news-empty":"N\u00e3o havia not\u00edcias no banco de dados","news-del-success":"Not\u00edcia exclu\u00edda","reboot-unconfirmed":"Confirma\u00e7\u00e3o para reinicializar n\u00e3o foi confirmada","invalid-template":"Template selecionado n\u00e3o \u00e9 v\u00e1lido","deleted-tag":"Tag foi removida com sucesso","updated-tags":"Tags foram atualizadas com sucesso"} \ No newline at end of file
+{"loginfail":"Nome de usu\u00e1rio ou senha incorreta","token":"Token inv\u00e1lido. Ataque CSRF?","adduser-disabled":"Privil\u00e9gios insuficientes para adicionar mais usu\u00e1rios","password-mismatch":"Senha e confirma\u00e7\u00e3o de senha n\u00e3o s\u00e3o iguais","empty-field":"Um campo n\u00e3o foi preenchido","adduser-success":"Usu\u00e1rio adicionado com sucesso","no-permission":"N\u00e3o h\u00e1 privil\u00e9gios suficientes para acessar essa p\u00e1gina","settings-updated":"As configura\u00e7\u00f5es foram atualizadas","debug-mode":"O modo de depura\u00e7\u00e3o est\u00e1 ativo!","value-invalid":"O valor {{1}} \u00e9 inv\u00e1lido para op\u00e7\u00e3o {{0}} e foi ignorado","invalid-action":"A\u00e7\u00e3o inv\u00e1lida: {{0}}","remote-timeout":"N\u00e3o foi poss\u00edvel baixar o recurso {{0}} ({{1}})","remote-parse-failed":"An\u00e1lise dos dados recebidos falhou ({{0}})","missing-file":"N\u00e3o havia nenhum arquivo selecionado!","invalid-file":"O arquivo {{0}} n\u00e3o existe!","upload-complete":"Envio de {{0}} foi bem sucedido","upload-failed":"Envio falhou: {{0}}","config-activated":"Configura\u00e7\u00e3o {{0}} foi ativada","config-invalid":"Configura\u00e7\u00e3o com id {{0}} n\u00e3o existe","error-write":"Erro ao escrever {{0}}","error-read":"Erro ao ler {{0}}","error-archive":"Arquivo corrompido ou formato n\u00e3o suportado","error-rename":"N\u00e3o foi poss\u00edvel renomear {{0}} em {{1}}","error-nodir":"O diret\u00f3rio {{0}} n\u00e3o existe.","empty-archive":"O arquivo n\u00e3o cont\u00e9m arquivos ou diret\u00f3rios","error-extract":"N\u00e3o foi poss\u00edvel descompactar arquivo {{0}} para {{1}}","module-added":"M\u00f3dulo adicionado com sucesso","module-deleted":"M\u00f3dulo {{0}} foi exclu\u00eddo","module-in-use":"M\u00f3dulo {{0}} ainda \u00e9 usado pela configura\u00e7\u00e3o {{1}}","taskmanager-error":"Falha ao conectar-se ao Gerenciador de Tarefas","taskmanager-format":"Gerenciador de Tarefas retornou dados inv\u00e1lidos","task-error":"Falha na execu\u00e7\u00e3o: {{0}}","invalid-ip":"Nenhuma interface est\u00e1 configurada com o endere\u00e7o {{0}}","news-save-success":"Not\u00edcia atualizada com sucesso","news-empty":"N\u00e3o havia not\u00edcias no banco de dados","news-del-success":"Not\u00edcia exclu\u00edda","reboot-unconfirmed":"Confirma\u00e7\u00e3o para reinicializar n\u00e3o foi confirmada","invalid-template":"Template selecionado n\u00e3o \u00e9 v\u00e1lido","deleted-tag":"Tag foi removida com sucesso","updated-tags":"Tags foram atualizadas com sucesso","unsuccessful-action":"A a\u00e7\u00e3o n\u00e3o foi bem sucedida"} \ No newline at end of file
diff --git a/lang/pt/page-minilinux.json b/lang/pt/page-minilinux.json
index 0f5aa3d1..c873855b 100644
--- a/lang/pt/page-minilinux.json
+++ b/lang/pt/page-minilinux.json
@@ -1,3 +1 @@
-{
- "lang_listObtained":"A lista está sendo obtida..."
-}
+{"lang_listObtained":"A lista est\u00e1 sendo obtida...","lang_errorGetting":""} \ No newline at end of file
diff --git a/lang/pt/administration/_page.json b/lang/pt/translation/_page.json
index 7a9fee55..7a9fee55 100644
--- a/lang/pt/administration/_page.json
+++ b/lang/pt/translation/_page.json
diff --git a/lang/pt/administration/messages.json b/lang/pt/translation/messages.json
index b4897277..b8da3765 100644
--- a/lang/pt/administration/messages.json
+++ b/lang/pt/translation/messages.json
@@ -1 +1 @@
-{"lang_messages":"Mensagens","lang_templateMessagesHelp":"Aqui \u00e9 poss\u00edvel alterar as mensagens exibidas no site.","lang_germanJSON":"JSON Alem\u00e3o","lang_englishJSON":"JSON Ingl\u00eas","lang_portugueseJSON":"JSON Portugu\u00eas","lang_germanTAG":"Mensagem em Alem\u00e3o","lang_englishTAG":"Mensagem em Ingl\u00eas","lang_portugueseTAG":"Mensagem em Portugu\u00eas","lang_back":"Voltar","lang_newTag":"Nova Mensagem","lang_update":"Carregar","lang_messagesHardcoded":"Mensagens Hardcoded","lang_newTAG":"Nova TAG","lang_deleteTAG":"Excluir"} \ No newline at end of file
+{"lang_messages":"Mensagens","lang_templateMessagesHelp":"Aqui \u00e9 poss\u00edvel alterar as mensagens exibidas no site.","lang_germanJSON":"JSON Alem\u00e3o","lang_englishJSON":"JSON Ingl\u00eas","lang_portugueseJSON":"JSON Portugu\u00eas","lang_germanTAG":"Mensagem em Alem\u00e3o","lang_englishTAG":"Mensagem em Ingl\u00eas","lang_portugueseTAG":"Mensagem em Portugu\u00eas","lang_back":"Voltar","lang_newTag":"Nova Mensagem","lang_messagesHardcoded":"Mensagens Hardcoded","lang_newTAG":"Nova TAG","lang_deleteTAG":"Excluir","lang_templateHint":"Dica: linhas amarelas indicam que uma tradu\u00e7\u00e3o est\u00e1 faltando e linhas vermelhas indicam que uma tag n\u00e3o \u00e9 utilizada pelo template.","lang_save":"Salvar"} \ No newline at end of file
diff --git a/lang/pt/translation/template.json b/lang/pt/translation/template.json
new file mode 100644
index 00000000..2db9a9af
--- /dev/null
+++ b/lang/pt/translation/template.json
@@ -0,0 +1 @@
+{"lang_templateAdminHelp":"","lang_germanJSON":"JSON Alem\u00e3o","lang_englishJSON":"JSON Ingl\u00eas","lang_portugueseJSON":"JSON Portugu\u00eas","lang_germanTAG":"TAG em Alem\u00e3o","lang_englishTAG":"TAG em Ingl\u00eas","lang_portugueseTAG":"TAG em Portugu\u00eas","lang_back":"Voltar","lang_createTag":"Criar TAG","lang_newTAG":"Nova TAG","lang_deleteTAG":"Excluir","lang_templateHint":"Dica: linhas amarelas indicam que uma tradu\u00e7\u00e3o est\u00e1 faltando e linhas vermelhas indicam que uma tag n\u00e3o \u00e9 utilizada pelo template.","lang_save":"Salvar"} \ No newline at end of file
diff --git a/modules/admin.inc.php b/modules/translation.inc.php
index 2941e21d..f563e8b0 100644
--- a/modules/admin.inc.php
+++ b/modules/translation.inc.php
@@ -1,18 +1,20 @@
<?php
-class Page_Admin extends Page
+class Page_Translation extends Page
{
-
+ /**
+ * The pages where you can administrate the website translations
+ * @var string|boolean holds the target template
+ * @var string|boolean used to choose which page to load
+ * @var string|boolean used check if there should be an update
+ * @var string|boolean used check if there should be a deletion
+ * @var array|boolean holds the tags of the selected template
+ */
private $template = false;
- private $path = false;
private $page = false;
private $update = false;
- private $files = false;
- private $table = false;
private $delete = false;
private $tags = false;
- private $unusedTags = false;
- private $message = false;
protected function doPreprocess()
{
@@ -43,48 +45,60 @@ class Page_Admin extends Page
protected function doRender()
{
+ //calls the update function
if($this->update) $this->updateJson();
+ //calls the tag deletion function
if($this->delete && $this->template) $this->deleteTag($this->template,$this->delete);
+ //load the page accordingly to the link
switch($this->page){
case 'messages':
- Render::addTemplate('administration/messages', array(
+ //renders the message edition page
+ Render::addTemplate('translation/messages', array(
'token' => Session::get('token'),
'msgs' => $this->initMsg(false),
'msgsHC' => $this->initMsg(true)
));
break;
case 'templates':
+ //renders the tag edition page
if($this->templateAnalysis($this->template)){
- Render::addTemplate('administration/template', array(
+ Render::addTemplate('translation/template', array(
'token' => Session::get('token'),
'template' => $this->template,
- 'path' => $this->path,
'tags' => $this->tags
));
break;
}
default:
- $this->initTable();
- Render::addTemplate('administration/_page', array(
+ //renders the template selection page
+ Render::addTemplate('translation/_page', array(
'token' => Session::get('token'),
'adminMessage' => $this->message,
- 'table' => $this->table
+ 'table' => $this->initTable(),
));
}
}
+ /**
+ * Load the main table with all the website's templates and it's informations
+ * @return array with the templates' information
+ */
private function initTable(){
- $this->listTemplates();
+ $table = array();
+
+ //loads every template
+ $files = $this->listTemplates();
+ //loads every json from each language
$de = $this->listJson('de/');
$en = $this->listJson('en/');
$pt = $this->listJson('pt/');
- foreach($this->files as $key => $value){
-
- $this->table[] = array(
+ //checks the JSON tags from every language
+ foreach($files as $key => $value){
+ $table[] = array(
'template' => $value,
'link' => $key,
'de' => $this->checkJson($de[$key],'de'),
@@ -92,23 +106,33 @@ class Page_Admin extends Page
'pt' => $this->checkJson($pt[$key],'pt')
);
}
-
- sort($this->table);
+ sort($table);
+ return $table;
}
+ /**
+ * Finds and returns all the website's templates
+ * @return array
+ */
private function listTemplates(){
- $this->files = array();
+ $files = array();
$dir = 'templates/';
$objects = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dir));
foreach($objects as $name => $object){
if(array_pop(explode('.',$name)) === 'html'){
$key = str_replace($dir, '', $name);
$key = str_replace('.html', '', $key);
- $this->files[$key] = $name;
+ $files[$key] = $name;
}
}
+ return $files;
}
+ /**
+ * Finds and returns all the JSON files from a selected language
+ * @param string the selected language (abbreviated)
+ * @return array all the JSON files from the language
+ */
private function listJson($lang){
$json = array();
$dir = 'lang/' . $lang;
@@ -123,38 +147,63 @@ class Page_Admin extends Page
return $json;
}
+ /**
+ * Checks the JSON tags from a template
+ * @param string the template's path
+ * @param string the selected language
+ * @return string the information about the JSON tags
+ */
private function checkJson($path,$lang){
+ //if there was not a valid template's path
if(!$path){
return "JSON file is missing";
}else{
+ //loads a template and find all its tags
$htmlTemplate = file_get_contents('templates/' . $path . '.html');
- $json = Dictionary::getArrayTemplate($path,$lang);
preg_match_all('/{{lang_(.*?)}}/s', $htmlTemplate, $matches);
$htmlCount = count(array_unique($matches[1]));
+
+ //initialize the count variables
$matchCount = 0;
+ $unusedCount = 0;
+ //loads the JSON tags and count the matches
+ $json = Dictionary::getArrayTemplate($path,$lang);
foreach($json as $key => $value){
if($key != 'lang'){
if(!in_array(preg_replace('/^lang_/', '', $key), $matches[1])){
- $matchCount++;
+ $unusedCount++;
}else if($value != ''){
$matchCount++;
}
}
}
-
$diff = $htmlCount - $matchCount;
- if($diff == 0) return "OK";
- if($diff > 0) return $diff . " JSON tag(s) are missing";
- if($diff < 0) return ($diff * -1) . " JSON tag(s) are not being used";
+
+ //build the return string
+ $str = "";
+ if($diff == 0 && $unusedCount == 0) $str .= "OK";
+ if($diff > 0) $str .= $diff . " JSON tag(s) are missing";
+ if($diff > 0 && $unusedCount > 0) $str .= "<br>";
+ if($unusedCount > 0) $str .= $unusedCount . " JSON tag(s) are not being used";
+ return $str;
}
}
+ /**
+ * Builds the template page with the tags from its template and its JSON file
+ * @param string the template's path
+ * @param string the selected language
+ * @return string the information about the JSON tags
+ */
private function templateAnalysis($path){
+ //checks if the template is valid
if(!file_exists('templates/' . $path . '.html')){
Message::addError('invalid-template');
return false;
}
+
+ //finds every mustache tag within the html template
$htmlTemplate = file_get_contents('templates/' . $path . '.html');
preg_match_all('/{{lang_(.*?)}}/s', $htmlTemplate, $matches);
$tags = $matches[1];
@@ -165,16 +214,19 @@ class Page_Admin extends Page
unset($tags[$key]);
}
- $langArray = array('en');
+ //finds every JSON tag withing the JSON language files
+ $langArray = array('de','en','pt');
$json = array();
foreach($langArray as $lang){
$jsonTags = Dictionary::getArrayTemplate($path,$lang);
$json = array_merge($json,$jsonTags);
}
-
+ //remove unused tag
unset($json['lang']);
+ //merges the arrays to keep the unique tags
$test = array_merge($json,$tags);
+ //loads the content of every JSON tag from the specified language
foreach($test as $tag=>$value){
$this->tags[] = array(
'tag' => $tag,
@@ -185,11 +237,16 @@ class Page_Admin extends Page
);
}
- $this->path = $path;
-
return true;
}
+ /**
+ * Loads the content of a JSON tag
+ * @param string the JSON's path
+ * @param string the selected tag
+ * @param string the specified language
+ * @return string the tag's content
+ */
private function checkJsonTag($path,$tag,$lang){
if($json = Dictionary::getArrayTemplate($path,$lang)){
return $json[$tag];
@@ -197,20 +254,33 @@ class Page_Admin extends Page
return '';
}
+ /**
+ * Change the color of the table line according to the tag status
+ * @param string the JSON's path
+ * @param string the selected tag
+ * @return string the css class of the line
+ */
private function checkJsonTags($path,$tag){
+ //return danger in case the tag is not found in the template
$htmlTemplate = file_get_contents('templates/' . $path . '.html');
$htmlCount = substr_count($htmlTemplate, $tag);
if($htmlCount < 1) return "danger";
+ //return warning in case at least one of the tag's values is empty
$langArray = array('de/','en/','pt/');
foreach($langArray as $lang){
if($json = Dictionary::getArrayTemplate($path,$lang)){
if(!isset($json[$tag]) || $json[$tag] == '') return 'warning';
}
}
+ //if it's ok don't change the class
return '';
}
+ /**
+ * Updates a JSON file with it's new tags or/and tags values
+ * @return boolean if the action was not successful
+ */
private function updateJson(){
$langArray = unserialize(SITE_LANGUAGES);
$json = array(
@@ -219,6 +289,7 @@ class Page_Admin extends Page
'pt' => array()
);
+ //find the tag requests to change the file
foreach($_REQUEST as $key => $value){
$str = explode('#',$key);
$pre = $str[0];
@@ -236,9 +307,11 @@ class Page_Admin extends Page
}
+ //saves the new values on the file
foreach($json as $key => $array){
$path = 'lang/' . $key . '/' . $_POST['path'] . '.json';
$json = json_encode($array,true);
+ //exits the function in case the action was unsuccessful
if(!file_put_contents($path,$json)){
Message::addError('invalid-template');
return false;
@@ -247,12 +320,19 @@ class Page_Admin extends Page
Message::addSuccess('updated-tags');
}
+ /**
+ * Load the main table with all the website's messages or hardcoded messages
+ * @var boolean choose between hardcoded and non-hardcoded messages
+ * @return array with the selected messages
+ */
private function initMsg($isHardcoded){
$msgs = array();
+ //chooses the path
$path = 'messages';
if($isHardcoded){
$path = 'messages-hardcoded';
}
+ //loads the content of every JSON tag from the message file
$json = Dictionary::getArrayTemplate($path,$lang);
foreach($json as $key => $array){
if($key != 'lang')
@@ -263,18 +343,28 @@ class Page_Admin extends Page
'pt' => $this->checkJsonTag($path,$key,'pt/')
);
}
-
return $msgs;
}
+ /**
+ * Delete a specific JSON tag from a JSON files
+ * @var string the JSON's file path
+ * @var the JSON tag to be deleted
+ * @return boolean if the action was not successful
+ */
private function deleteTag($path,$tag){
+ //delete the tag from every language file
$langArray = unserialize(SITE_LANGUAGES);
foreach($langArray as $lang){
$json = Dictionary::getArrayTemplate($path,$lang);
unset($json[$tag]);
unset($json['lang']);
- //file_put_contents('test.txt','lang/' . $lang . '/' . $path . '.json');
- file_put_contents('lang/' . $lang . '/' . $path . '.json', json_encode($json));
+ $result = file_put_contents('lang/' . $lang . '/' . $path . '.json', json_encode($json));
+ //add warning and exit in case the action was unsuccessful
+ if($result === false){
+ Message::addWarning('unsuccessful-action');
+ return false;
+ }
}
Message::addSuccess('deleted-tag');
}
diff --git a/templates/administration/_page.html b/templates/translation/_page.html
index ac24ed71..8e5e4bab 100644
--- a/templates/administration/_page.html
+++ b/templates/translation/_page.html
@@ -7,7 +7,7 @@
<p>{{lang_adminInfo}}</p>
</div>
<ul class="list-group">
- <a href="?do=Admin&page=messages" class="list-group-item active">{{lang_editMessages}}</a>
+ <a href="?do=Translation&page=messages" class="list-group-item active">{{lang_editMessages}}</a>
</ul>
</div>
<div class="panel panel-default">
@@ -24,9 +24,9 @@
{{#table}}
<tr onclick="goTo('{{link}}');">
<td>{{template}}</td>
- <td style='width:230px;text-align:center;'>{{de}}</td>
- <td style='width:230px;text-align:center;'>{{en}}</td>
- <td style='width:230px;text-align:center;'>{{pt}}</td>
+ <td style='width:230px;text-align:center;'>{{{de}}}</td>
+ <td style='width:230px;text-align:center;'>{{{en}}}</td>
+ <td style='width:230px;text-align:center;'>{{{pt}}}</td>
</tr>
{{/table}}
</tbody>
@@ -35,6 +35,6 @@
</div>
<script>
function goTo(link){
- window.location.href = "?do=Admin&page=templates&template=" + link;
+ window.location.href = "?do=Translation&page=templates&template=" + link;
}
</script>
diff --git a/templates/administration/messages.html b/templates/translation/messages.html
index 7cf042e8..c065c7f7 100644
--- a/templates/administration/messages.html
+++ b/templates/translation/messages.html
@@ -4,9 +4,12 @@
{{lang_messages}}
</div>
<div class="panel-body">
- <p>{{lang_templateMessagesHelp}}
+ <p>{{lang_templateMessagesHelp}}</p>
+ <div class="alert alert-info">
+ {{lang_templateHint}}
+ </div>
</div>
- <form action="?do=Admin" method="post">
+ <form action="?do=Translation" method="post">
<table class="table table-hover">
<thead>
<tr>
@@ -31,7 +34,7 @@
<input type="text" class="form-control" placeholder="{{lang_portugueseTAG}}" value="{{pt}}" name="lang#pt#{{tag}}">
</td>
<td style='text-align:center;'>
- <a class="btn btn-danger btn-xs" href="?do=Admin&template=messages&delete={{tag}}"><span class="glyphicon glyphicon-remove"></span> {{lang_deleteTAG}}</a>
+ <a class="btn btn-danger btn-xs" href="?do=Translation&template=messages&delete={{tag}}"><span class="glyphicon glyphicon-remove"></span> {{lang_deleteTAG}}</a>
</td>
</tr>
{{/msgs}}
@@ -40,15 +43,15 @@
</tbody>
</table>
<div class="panel-body">
- <a class="btn btn-primary" href='?do=Admin' >{{lang_back}}</a>
+ <a class="btn btn-primary" href='?do=Translation' >{{lang_back}}</a>
<button class="btn btn-primary" type="button" onclick="addTag(false);" >{{lang_newTag}}</button>
<input type="hidden" name="update" value="true">
<input type="hidden" name="path" value="messages">
<input type="hidden" name="token" value="{{token}}">
- <input type="submit" class="btn btn-primary" value="{{lang_update}}">
+ <input type="submit" class="btn btn-primary" value="{{lang_save}}">
</form>
</div>
- <form action="?do=Admin" method="post">
+ <form action="?do=Translation" method="post">
<table class="table table-hover">
<thead>
<tr>
@@ -73,7 +76,7 @@
<input type="text" class="form-control" placeholder="{{lang_portugueseTAG}}" value="{{pt}}" name="lang#pt#{{tag}}">
</td>
<td style='text-align:center;'>
- <a class="btn btn-danger btn-xs" href="?do=Admin&template=messages-hardcoded&delete={{tag}}"><span class="glyphicon glyphicon-remove"></span> {{lang_deleteTAG}}</a>
+ <a class="btn btn-danger btn-xs" href="?do=Translation&template=messages-hardcoded&delete={{tag}}"><span class="glyphicon glyphicon-remove"></span> {{lang_deleteTAG}}</a>
</td>
</tr>
{{/msgsHC}}
@@ -82,12 +85,12 @@
</tbody>
</table>
<div class="panel-body">
- <a class="btn btn-primary" href='?do=Admin' >{{lang_back}}</a>
+ <a class="btn btn-primary" href='?do=Translation' >{{lang_back}}</a>
<button class="btn btn-primary" type="button" onclick="addTag(true);" >{{lang_newTag}}</button>
<input type="hidden" name="update" value="true">
<input type="hidden" name="path" value="messages-hardcoded">
<input type="hidden" name="token" value="{{token}}">
- <input type="submit" class="btn btn-primary" value="{{lang_update}}">
+ <input type="submit" class="btn btn-primary" value="{{lang_save}}">
</form>
</div>
</div>
diff --git a/templates/administration/template.html b/templates/translation/template.html
index 5a89bb3d..11d4e4e7 100644
--- a/templates/administration/template.html
+++ b/templates/translation/template.html
@@ -4,8 +4,11 @@
{{template}}
</div>
<div class="panel-body">
- <p>{{lang_templateAdminHelp}}
- <form action="?do=Admin" method="post">
+ <p>{{lang_templateAdminHelp}}</p>
+ <div class="alert alert-info">
+ {{lang_templateHint}}
+ </div>
+ <form action="?do=Translation" method="post">
<table class="table table-hover">
<thead>
<tr>
@@ -30,7 +33,7 @@
<input type="text" class="form-control" placeholder="{{lang_portugueseTAG}}" value="{{pt}}" name="lang#pt#{{tag}}">
</td>
<td style='text-align:center;'>
- <a class="btn btn-danger btn-xs" href="?do=Admin&template={{path}}&delete={{tag}}"><span class="glyphicon glyphicon-remove"></span> {{lang_deleteTAG}}</a>
+ <a class="btn btn-danger btn-xs" href="?do=Translation&template={{template}}&delete={{tag}}"><span class="glyphicon glyphicon-remove"></span> {{lang_deleteTAG}}</a>
</td>
</tr>
{{/tags}}
@@ -38,12 +41,12 @@
</tr>
</tbody>
</table>
- <a class="btn btn-primary" href='?do=Admin' >{{lang_back}}</a>
+ <a class="btn btn-primary" href='?do=Translation' >{{lang_back}}</a>
<button class="btn btn-primary" type="button" onclick="addTag(true);" >{{lang_createTag}}</button>
<input type="hidden" name="update" value="true">
- <input type="hidden" name="path" value="{{path}}">
+ <input type="hidden" name="path" value="{{template}}">
<input type="hidden" name="token" value="{{token}}">
- <input type="submit" class="btn btn-primary" value="{{lang_update}}">
+ <input type="submit" class="btn btn-primary" value="{{lang_save}}">
</form>
</div>
</div>