diff options
author | marvin-borner@live.com | 2018-04-17 18:35:48 +0200 |
---|---|---|
committer | marvin-borner@live.com | 2018-04-17 18:35:48 +0200 |
commit | 6c9fc1146f466230840d9177f5b0daf1f55a8313 (patch) | |
tree | a5da06b510cc1b780d12d86619a03bb7cabc685b | |
parent | aac2385c32ae2fe4462a6fb038a4619c0019e2ee (diff) |
Fixed translation issues - extended cms use
-rwxr-xr-x | README.md | 15 | ||||
-rwxr-xr-x | main/app/sprinkles/core/asset-bundles.json | 2 | ||||
-rwxr-xr-x | main/app/sprinkles/core/config/default.php | 2 | ||||
-rw-r--r-- | main/app/sprinkles/core/locale/de_DE/main.php | 15 | ||||
-rwxr-xr-x | main/app/sprinkles/core/locale/de_DE/messages.php | 150 | ||||
-rw-r--r-- | main/app/sprinkles/core/locale/en_US/main.php | 15 | ||||
-rw-r--r-- | main/app/sprinkles/core/locale/fr_FR/main.php | 15 | ||||
-rw-r--r-- | main/app/sprinkles/core/templates/pages/abstract/mainsite.html.twig | 1 | ||||
-rwxr-xr-x | main/app/sprinkles/core/templates/pages/index.html.twig | 20 | ||||
-rw-r--r-- | main/app/sprinkles/core/templates/pages/partials/chat.js.twig (renamed from main/app/sprinkles/core/assets/SiteAssets/js/chat.js) | 16 | ||||
-rwxr-xr-x | startserver.sh | 2 |
11 files changed, 150 insertions, 103 deletions
@@ -1,17 +1,22 @@ # BEAM-Messenger -The messenenger with that certain something. -Just a task for me to create my own social network. -It's not my aim to create a **popular** social network. -## The things the network should/will feature +The messenger with that certain something. +Just a task for me to create my own messenger with integrated social network like features. +It's not my aim to create a **popular** messenger/social network. +### The things the messenger should/will feature * Easy interface * Fast responses * Secure backend * **NO** data-selling * Free to use (except for donations :) ) * Open source -* Realtime chat +* Realtime end-to-end encrypted chat * Image uploading * Status and/or story feature * Friend and followers * Groups in chats **and** in image feed +### File placements +* Main site code is in `/main/app/sprinkles/core/` +* The Twig templates of the actual site you'll see are in `/main/app/sprinkles/core/templates/pages/` +* Other important things are mostly somewhere in the `sprinkles` directory - other directories are mostly configuration, logs, cache etc. + diff --git a/main/app/sprinkles/core/asset-bundles.json b/main/app/sprinkles/core/asset-bundles.json index 053fffe..caa5d7b 100755 --- a/main/app/sprinkles/core/asset-bundles.json +++ b/main/app/sprinkles/core/asset-bundles.json @@ -49,9 +49,7 @@ "SiteAssets/js/fontawesome.js", "SiteAssets/js/modernizr.js", "SiteAssets/js/linkify.js", - "SiteAssets/js/language.js", "SiteAssets/js/encryption.js", - "SiteAssets/js/chat.js", "SiteAssets/js/slick.js", "SiteAssets/js/main.js" ], diff --git a/main/app/sprinkles/core/config/default.php b/main/app/sprinkles/core/config/default.php index 2e62fd1..134b5d4 100755 --- a/main/app/sprinkles/core/config/default.php +++ b/main/app/sprinkles/core/config/default.php @@ -154,7 +154,7 @@ // This can be a comma-separated list, to load multiple fallback locales 'default' => 'en_US' ], - 'title' => 'SocialNetwork', + 'title' => 'BEAM-Messenger', // Global ufTable settings 'uf_table' => [ 'use_loading_transition' => true diff --git a/main/app/sprinkles/core/locale/de_DE/main.php b/main/app/sprinkles/core/locale/de_DE/main.php new file mode 100644 index 0000000..250e038 --- /dev/null +++ b/main/app/sprinkles/core/locale/de_DE/main.php @@ -0,0 +1,15 @@ +<?php
+return [
+ "TAB_CAPTIONS" => [
+ "FEED" => "Neues",
+ "EXPLORE" => "Entdecken",
+ "CHAT" => "Nachrichten",
+ "FRIENDS" => "Freunde",
+ "PERSONAL" => "Persönliche Daten"
+ ],
+ "CHAT_MESSAGES" => [
+ "USER_GROUP_JOIN" => "{{user}} ist der Gruppe beigetreten",
+ "YOU_GROUP_JOIN" => "Du bist der Gruppe beigetreten",
+ "USER_DISCONNECT" => "{{user}} hat sich vom Server getrennt"
+ ]
+];
\ No newline at end of file diff --git a/main/app/sprinkles/core/locale/de_DE/messages.php b/main/app/sprinkles/core/locale/de_DE/messages.php index e254c65..999947d 100755 --- a/main/app/sprinkles/core/locale/de_DE/messages.php +++ b/main/app/sprinkles/core/locale/de_DE/messages.php @@ -16,108 +16,108 @@ return [ "@PLURAL_RULE" => 1, - "ABOUT" => "Über", + "ABOUT" => "Über", "CAPTCHA" => [ - "@TRANSLATION" => "Sicherheitscode", - "FAIL" => "Sie haben den Sicherheitscode nicht korrekt eingegeben.", - "SPECIFY" => "Geben Sie den Sicherheitscode ein", - "VERIFY" => "Überprüfen Sie den Sicherheitscode" + "@TRANSLATION" => "Sicherheitscode", + "FAIL" => "Sie haben den Sicherheitscode nicht korrekt eingegeben.", + "SPECIFY" => "Geben Sie den Sicherheitscode ein", + "VERIFY" => "Überprüfen Sie den Sicherheitscode" ], - "CSRF_MISSING" => "Fehlender CSRF-Token. Versuchen, die Seite zu aktualisieren und erneut zu senden?", + "CSRF_MISSING" => "Fehlender CSRF-Token. Versuchen, die Seite zu aktualisieren und erneut zu senden?", - "DB_INVALID" => "Keine Verbindung zur Datenbank möglich. Wenn Sie ein Administrator sind, überprüfen Sie bitte Ihr Fehlerprotokoll.", - "DESCRIPTION" => "Beschreibung", + "DB_INVALID" => "Keine Verbindung zur Datenbank möglich. Wenn Sie ein Administrator sind, überprüfen Sie bitte Ihr Fehlerprotokoll.", + "DESCRIPTION" => "Beschreibung", "DOWNLOAD" => [ - "@TRANSLATION" => "Herunterladen", - "CSV" => "CSV herunterladen" + "@TRANSLATION" => "Herunterladen", + "CSV" => "CSV herunterladen" ], "EMAIL" => [ - "@TRANSLATION" => "E-Mail", - "YOUR" => "Ihre E-Mail-Adresse" + "@TRANSLATION" => "E-Mail", + "YOUR" => "Ihre E-Mail-Adresse" ], - "HOME" => "Startseite", + "HOME" => "Startseite", "LEGAL" => [ - "@TRANSLATION" => "Rechtsgrundsatz", - "DESCRIPTION" => "Unser Rechtsgrundsatz gilt für die Benutzung dieser Internetseite und unserer Dienste." + "@TRANSLATION" => "Rechtsgrundsatz", + "DESCRIPTION" => "Unser Rechtsgrundsatz gilt für die Benutzung dieser Internetseite und unserer Dienste." ], "LOCALE" => [ - "@TRANSLATION" => "Sprache" + "@TRANSLATION" => "Sprache" ], - "NAME" => "Name", - "NAVIGATION" => "Navigation", - "NO_RESULTS" => "Sorry, hier gibt es bisher nichts zu sehen.", + "NAME" => "Name", + "NAVIGATION" => "Navigation", + "NO_RESULTS" => "Sorry, hier gibt es bisher nichts zu sehen.", "PAGINATION" => [ - "GOTO" => "Gehe zu Seite", - "SHOW" => "Anzeigen", - - // Paginator - // possible variables: {size}, {page}, {totalPages}, {filteredPages}, {startRow}, {endRow}, {filteredRows} and {totalRows} - // also {page:input} & {startRow:input} will add a modifiable input in place of the value - "OUTPUT" => "{startRow} bis {endRow} von {filteredRows} ({totalRows})", - - "NEXT" => "Nächste Seite", - "PREVIOUS" => "Vorherige Seite", - "FIRST" => "Erste Seite", - "LAST" => "Letzte Seite" + "GOTO" => "Gehe zu Seite", + "SHOW" => "Anzeigen", + + // Paginator + // possible variables: {size}, {page}, {totalPages}, {filteredPages}, {startRow}, {endRow}, {filteredRows} and {totalRows} + // also {page:input} & {startRow:input} will add a modifiable input in place of the value + "OUTPUT" => "{startRow} bis {endRow} von {filteredRows} ({totalRows})", + + "NEXT" => "Nächste Seite", + "PREVIOUS" => "Vorherige Seite", + "FIRST" => "Erste Seite", + "LAST" => "Letzte Seite" ], "PRIVACY" => [ - "@TRANSLATION" => "Datenschutzbestimmungen", - "DESCRIPTION" => "In unsere Datenschutzbestimmungen erklären wir Ihnen, welche Daten wir sammeln und wozu wir diese benutzen." + "@TRANSLATION" => "Datenschutzbestimmungen", + "DESCRIPTION" => "In unsere Datenschutzbestimmungen erklären wir Ihnen, welche Daten wir sammeln und wozu wir diese benutzen." ], - "SLUG" => "Schnecke", - "SLUG_CONDITION" => "Schnecke/Bedingungen", - "SLUG_IN_USE" => "Die Schnecke <strong>{{slug}}</strong> existiert bereits", - "STATUS" => "Status", - "SUGGEST" => "Vorschlagen", + "SLUG" => "Schnecke", + "SLUG_CONDITION" => "Schnecke/Bedingungen", + "SLUG_IN_USE" => "Die Schnecke <strong>{{slug}}</strong> existiert bereits", + "STATUS" => "Status", + "SUGGEST" => "Vorschlagen", - "UNKNOWN" => "Unbekannt", + "UNKNOWN" => "Unbekannt", // Actions words - "ACTIONS" => "Aktionen", - "ACTIVATE" => "Aktivieren", - "ACTIVE" => "Aktiv", - "ADD" => "Hinzufügen", - "CANCEL" => "Abbrechen", - "CONFIRM" => "Bestätigen", - "CREATE" => "Erstellen", - "DELETE" => "Löschen", - "DELETE_CONFIRM" => "Möchten Sie diese wirklich löschen?", - "DELETE_CONFIRM_YES" => "Ja, löschen", - "DELETE_CONFIRM_NAMED" => "Möchten Sie {{name}} wirklich löschen?", - "DELETE_CONFIRM_YES_NAMED" => "Ja, {{name}} löschen", - "DELETE_CANNOT_UNDONE" => "Diese Aktion kann nicht rückgängig gemacht werden.", - "DELETE_NAMED" => "{{name}} löschen", - "DENY" => "Verweigern", - "DISABLE" => "Deaktivieren", - "DISABLED" => "Deaktiviert", - "EDIT" => "Bearbeiten", - "ENABLE" => "Aktivieren", - "ENABLED" => "Aktiviert", - "OVERRIDE" => "Überschreiben", - "RESET" => "Zurücksetzen", - "SAVE" => "Speichern", - "SEARCH" => "Suchen", - "SORT" => "Sortieren", - "SUBMIT" => "Einreichen", - "PRINT" => "Drucken", - "REMOVE" => "Entfernen", - "UNACTIVATED" => "Unaktiviert", - "UPDATE" => "Aktualisieren", - "YES" => "Ja", - "NO" => "Nein", - "OPTIONAL" => "Optional", + "ACTIONS" => "Aktionen", + "ACTIVATE" => "Aktivieren", + "ACTIVE" => "Aktiv", + "ADD" => "Hinzufügen", + "CANCEL" => "Abbrechen", + "CONFIRM" => "Bestätigen", + "CREATE" => "Erstellen", + "DELETE" => "Löschen", + "DELETE_CONFIRM" => "Möchten Sie diese wirklich löschen?", + "DELETE_CONFIRM_YES" => "Ja, löschen", + "DELETE_CONFIRM_NAMED" => "Möchten Sie {{name}} wirklich löschen?", + "DELETE_CONFIRM_YES_NAMED" => "Ja, {{name}} löschen", + "DELETE_CANNOT_UNDONE" => "Diese Aktion kann nicht rückgängig gemacht werden.", + "DELETE_NAMED" => "{{name}} löschen", + "DENY" => "Verweigern", + "DISABLE" => "Deaktivieren", + "DISABLED" => "Deaktiviert", + "EDIT" => "Bearbeiten", + "ENABLE" => "Aktivieren", + "ENABLED" => "Aktiviert", + "OVERRIDE" => "Überschreiben", + "RESET" => "Zurücksetzen", + "SAVE" => "Speichern", + "SEARCH" => "Suchen", + "SORT" => "Sortieren", + "SUBMIT" => "Einreichen", + "PRINT" => "Drucken", + "REMOVE" => "Entfernen", + "UNACTIVATED" => "Unaktiviert", + "UPDATE" => "Aktualisieren", + "YES" => "Ja", + "NO" => "Nein", + "OPTIONAL" => "Optional", // Misc. - "BUILT_WITH_UF" => "Errichtet mit <a href=\"http://www.userfrosting.com\">UserFrosting</a>", - "ADMINLTE_THEME_BY" => "Theme von <strong><a href=\"http://almsaeedstudio.com\">Almsaeed Studio</a>.</strong> Alle Rechte vorbehalten", - "WELCOME_TO" => "Willkommen auf {{title}}!" + "BUILT_WITH_UF" => "Errichtet mit <a href=\"http://www.userfrosting.com\">UserFrosting</a>", + "ADMINLTE_THEME_BY" => "Theme von <strong><a href=\"http://almsaeedstudio.com\">Almsaeed Studio</a>.</strong> Alle Rechte vorbehalten", + "WELCOME_TO" => "Willkommen auf {{title}}!" ]; diff --git a/main/app/sprinkles/core/locale/en_US/main.php b/main/app/sprinkles/core/locale/en_US/main.php new file mode 100644 index 0000000..99933b1 --- /dev/null +++ b/main/app/sprinkles/core/locale/en_US/main.php @@ -0,0 +1,15 @@ +<?php
+return [
+ "TAB_CAPTIONS" => [
+ "FEED" => "New",
+ "EXPLORE" => "Explore",
+ "CHAT" => "Chat",
+ "FRIENDS" => "Friends",
+ "PERSONAL" => "Personal"
+ ],
+ "CHAT_MESSAGES" => [
+ "USER_GROUP_JOIN" => "{{user}} joined the group",
+ "YOU_GROUP_JOIN" => "You joined the group",
+ "USER_DISCONNECT" => "{{user}} has disconnected from the server"
+ ]
+];
\ No newline at end of file diff --git a/main/app/sprinkles/core/locale/fr_FR/main.php b/main/app/sprinkles/core/locale/fr_FR/main.php new file mode 100644 index 0000000..df913dc --- /dev/null +++ b/main/app/sprinkles/core/locale/fr_FR/main.php @@ -0,0 +1,15 @@ +<?php
+return [
+ "TAB_CAPTIONS" => [
+ "FEED" => "D'actualités",
+ "EXPLORE" => "Dépister",
+ "CHAT" => "Message",
+ "FRIENDS" => "Camarades",
+ "PERSONAL" => "Personnelles"
+ ],
+ "CHAT_MESSAGES" => [
+ "USER_GROUP_JOIN" => "{{user}} s'est joint au groupe",
+ "YOU_GROUP_JOIN" => "Vous avez rejoint le groupe",
+ "USER_DISCONNECT" => "{{user}} s'est déconnecté du serveur"
+ ]
+];
diff --git a/main/app/sprinkles/core/templates/pages/abstract/mainsite.html.twig b/main/app/sprinkles/core/templates/pages/abstract/mainsite.html.twig index d12ccde..fe21d34 100644 --- a/main/app/sprinkles/core/templates/pages/abstract/mainsite.html.twig +++ b/main/app/sprinkles/core/templates/pages/abstract/mainsite.html.twig @@ -8,7 +8,6 @@ <!-- The 'X-UA-Compatible' tag must be first, otherwise IE will not respect it. See http://stackoverflow.com/questions/25557299/internet-explorer-11-disable-display-intranet-sites-in-compatibility-view-via -->
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta charset="utf-8">
- <meta name="generator" content="UserFrosting" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<meta name="description" content="{% block page_description %}This page has not yet been configured.{% endblock %}">
<meta name="author" content="{% block page_author %}{{ site.author }}{% endblock %}">
diff --git a/main/app/sprinkles/core/templates/pages/index.html.twig b/main/app/sprinkles/core/templates/pages/index.html.twig index 4c7c838..5de2d30 100755 --- a/main/app/sprinkles/core/templates/pages/index.html.twig +++ b/main/app/sprinkles/core/templates/pages/index.html.twig @@ -15,7 +15,7 @@ <div class="header"> <span class="LeftButtonHeader"><img draggable="false" ondragstart="return false;" src="{{ assets.url('assets://SiteAssets/icons/BurgerMenuShort.svg') }}"></span> - <span class="HeaderCaption"><span data-lang='Feed'></span></span> + <span class="HeaderCaption">{{ translate("TAB_CAPTIONS.FEED") }}</span> <span class="RightButtonHeader"><i class="fas fa-bell"></i></span> </div> <hr> @@ -26,7 +26,7 @@ <div class="header"> <span class="LeftButtonHeader"><img draggable="false" ondragstart="return false;" src="{{ assets.url('assets://SiteAssets/icons/BurgerMenuShort.svg') }}"></span> - <span class="HeaderCaption"><span data-lang='Explore'></span></span> + <span class="HeaderCaption">{{ translate("TAB_CAPTIONS.EXPLORE") }}</span> <span class="RightButtonHeader"><i class="fas fa-bell"></i></span> </div> <hr> @@ -37,7 +37,7 @@ <div class="header"> <span class="LeftButtonHeader"><img draggable="false" ondragstart="return false;" src="{{ assets.url('assets://SiteAssets/icons/BurgerMenuShort.svg') }}"></span> - <span class="HeaderCaption"><span data-lang='Chat'></span></span> + <span class="HeaderCaption">{{ translate("TAB_CAPTIONS.CHAT") }}</span> <span class="RightButtonHeader"><i class="fas fa-bell"></i></span> </div> <hr> @@ -57,7 +57,7 @@ <div class="header"> <span class="LeftButtonHeader"><img draggable="false" ondragstart="return false;" src="{{ assets.url('assets://SiteAssets/icons/BurgerMenuShort.svg') }}"></span> - <span class="HeaderCaption"><span data-lang='Friends'></span></span> + <span class="HeaderCaption">{{ translate("TAB_CAPTIONS.FRIENDS") }}</span> <span class="RightButtonHeader"><i class="fas fa-bell"></i></span> </div> <hr> @@ -68,7 +68,7 @@ <div class="header"> <span class="LeftButtonHeader"><img draggable="false" ondragstart="return false;" src="{{ assets.url('assets://SiteAssets/icons/BurgerMenuShort.svg') }}"></span> - <span class="HeaderCaption"><span data-lang='Personal'></span></span> + <span class="HeaderCaption">{{ translate("TAB_CAPTIONS.PERSONAL") }}</span> <span class="RightButtonHeader"><i class="fas fa-bell"></i></span> </div> <hr> @@ -97,16 +97,8 @@ </div> {% endblock %} - - {% block scripts_page %} - <!-- Script to Activate the Language --> <script> - function initiateLanguage() { - var translate = new Translate(); - var currentLng = 'de'; // <- PHP IP LOCATION - translate.init(currentLng); - translate.process(); - } + {% include "pages/partials/chat.js.twig" %} </script> {% endblock %} diff --git a/main/app/sprinkles/core/assets/SiteAssets/js/chat.js b/main/app/sprinkles/core/templates/pages/partials/chat.js.twig index bcb910b..779008f 100644 --- a/main/app/sprinkles/core/assets/SiteAssets/js/chat.js +++ b/main/app/sprinkles/core/templates/pages/partials/chat.js.twig @@ -1,9 +1,11 @@ +{% autoescape 'js' %}
+
/************
GENERATE KEYS
************/
if (localStorage.getItem('KeysGenerated') === null || localStorage.getItem('KeysGenerated') !== "true") {
// GENERATE -- LATER ON LOGIN!
- var EncryptionPhrase = "PASSWORD 123"; // THE USERS PASSWORD
+ var EncryptionPhrase = "PASSWORD 123"; // THE USERS PASSWORD -- needs to generate on login!
var RSABitLength = 1024;
var PrivateKeyString = cryptico.generateRSAKey(EncryptionPhrase, RSABitLength);
var PublicKeyString = cryptico.publicKeyString(PrivateKeyString);
@@ -80,16 +82,19 @@ WebSocket.onmessage = function (e) { } else if (MessageObject.ServerMessage === true) {
if (MessageObject.ServerMessageType === "GroupJoin") {
if (MessageObject.WasHimself === false) {
- ChatMessages.append("<div class='ServerChatMessage'>" + MessageObject.Username + " <span data-lang='joined the group'></span>.</div><br><br>");
+ var TempJoinMessage = "{{ translate("CHAT_MESSAGES.USER_GROUP_JOIN", {user: "ConvertTranslatedMessageWithUsername"}) }}";
+ var GeneratedJoinMessage = TempJoinMessage.replace("ConvertTranslatedMessageWithUsername", MessageObject.Username);
+ ChatMessages.append("<div class='ServerChatMessage'>" + GeneratedJoinMessage + ".</div><br><br>");
} else if (MessageObject.WasHimself === true) {
ChatMessages.empty();
- ChatMessages.append("<div class='ServerChatMessage'><span data-lang='You joined the group'> " + MessageObject.GroupName + "</span>.</div><br><br>");
+ ChatMessages.append("<div class='ServerChatMessage'>{{ translate("CHAT_MESSAGES.YOU_GROUP_JOIN") }} " + MessageObject.GroupName + "</span>.</div><br><br>");
}
} else if (MessageObject.ServerMessageType === "UserDisconnect") {
- ChatMessages.append("<div class='ServerChatMessage'>" + MessageObject.Username + " <span data-lang='has disconnected from the server'></span>.</div><br><br>");
+ var TempDisconnectMessage = "{{ translate("CHAT_MESSAGES.USER_DISCONNECT", {user: "ConvertTranslatedMessageWithUsername"}) }}";
+ var GeneratedDisconnectMessage = TempDisconnectMessage.replace("ConvertTranslatedMessageWithUsername", MessageObject.Username);
+ ChatMessages.append("<div class='ServerChatMessage'>" + GeneratedDisconnectMessage + ".</div><br><br>");
}
}
- initiateLanguage(); // need further work (performance)
};
ChatTextInput.keyup(function (e) {
@@ -115,3 +120,4 @@ function sendMessage(msg) { WebSocket.send(JSON.stringify({ClientMessageType: "Message", Message: msg}));
ChatTextInput.val("");
}
+{% endautoescape %}
\ No newline at end of file diff --git a/startserver.sh b/startserver.sh new file mode 100755 index 0000000..f9754aa --- /dev/null +++ b/startserver.sh @@ -0,0 +1,2 @@ +cd main/app/sprinkles/core/assets/SiteAssets/php/Chatserver/bin/ +php WebChatServer.php |