Browse Source

merge language changes

trendschau 5 years ago
parent
commit
f129548006

+ 2 - 27
system/Controllers/SetupController.php

@@ -52,31 +52,9 @@ class SetupController extends Controller
 		$setuperrors = empty($systemcheck) ? false : 'Some system requirements for Typemill are missing.';
 		$systemcheck = empty($systemcheck) ? false : $systemcheck;
 
-    # Get the translated strings
-    $labels = $this->getSetupLabels();
-
-		return $this->render($response, 'auth/setup.twig', array( 'messages' => $setuperrors, 'systemcheck' => $systemcheck, 'labels' => $labels ));
+    return $this->render($response, 'auth/setup.twig', array( 'messages' => $setuperrors, 'systemcheck' => $systemcheck ));
 	}
 
-  public function getSetupLabels()
-  {
-    # Check which languages are available
-    $langs = [];
-    $path = __DIR__ . '/../author/languages/*.yaml';
-    foreach (glob($path) as $filename) {
-      $langs[] = basename($filename,'.yaml');
-    }
-    
-    # Detect browser language
-    $accept_lang = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2);
-    $lang = in_array($accept_lang, $langs) ? $accept_lang : 'en';
-
-    # At least in the setup phase noon there should be no plugins and the theme should be typemill
-    $labels = \Typemill\Settings::getLanguageLabels($lang,'typemill',[]);
-
-    return $labels;
-  }
-
 
 	public function create($request, $response, $args)
 	{
@@ -122,9 +100,6 @@ class SetupController extends Controller
 		/* store updated settings */
 		\Typemill\Settings::updateSettings(array('welcome' => false));
 
-    # Get the translated strings
-    $labels = $this->getSetupLabels();
-		
-		return $this->render($response, 'auth/welcome.twig', array( 'labels' => $labels ));		
+    return $this->render($response, 'auth/welcome.twig', array());		
 	}
 }

+ 1 - 43
system/Extensions/TwigLanguageExtension.php

@@ -17,59 +17,17 @@ class TwigLanguageExtension extends \Twig_Extension
   {
     return [
       new \Twig_SimpleFilter('__', [$this,'translate'] ),
-      new \Twig_SimpleFilter('ta', [$this,'translate_array'] )
     ];
   }
 
 	public function getFunctions()
 	{
 		return [
-			new \Twig_SimpleFunction('__', array($this, 'translate' )),
-      new \Twig_SimpleFunction('ta', [$this,'translate_array'] )
+			new \Twig_SimpleFunction('__', array($this, 'translate' ))
 		];
 	}
 
 
-  public function translate_array( $label )
-  {
-    /* In reality the function does not Translate an Array but a string, temporarily transformed into an array.
-     * I saw a filter/function with this name in Grav.
-     * Example:
-      
-       $label -> placeholder="Add Label for Start-Button" value="Start"
-      
-       after explode:
-       {
-        [0]=> string(13) " placeholder="
-        [1]=> string(26) "Add Label for Start-Button"
-        [2]=> string(7) " value="
-        [3]=> string(5) "Start"
-        [4]=> string(0) ""
-      }
-      
-     */
-    $translated_label = '';
-    $items = explode('"',$label);
-    foreach($items as $item){
-      // skip empty string
-      if(!empty($item)){
-        $pos = strpos($item, '=');
-        //skip string containing equal sign
-        if ($pos === false) {
-          // translate with previous function in this class
-          $translated = $this->translate($item);
-          // add the translated string
-          $translated_label .= '"'.$translated.'"';
-        } else {
-          // adds the string containing the equal sign
-          $translated_label .= $item;
-        }
-      }
-    }
-    return $translated_label;
-  }
-
-  
   public function translate( $label )
 	{
     // replaces spaces, dots, comma and dash with underscores 

+ 0 - 75
system/Settings.php

@@ -38,22 +38,6 @@ class Settings
 			}
 		}
 
-		# let us load translations only for admin area to improve performance for frontend
-		$uri = $_SERVER['REQUEST_URI'];
-		if(isset($uri) && (strpos($uri,'/tm/') !== false OR strpos($uri,'/setup') !== false))
-		{
-		    # i18n
-		    # load the strings of the set language
-		    $language = $settings['language'];
-		    $theme = $settings['theme'];
-		    $plugins = [];
-		    if(isset($settings['plugins']))
-		    {
-	        	$plugins = $settings['plugins'];
-	      	}
-	      	$settings['labels'] = self::getLanguageLabels($language, $theme, $plugins);
-		}
-
 		# We know the used theme now so create the theme path 
 		$settings['themePath'] = $settings['rootPath'] . $settings['themeFolder'] . DIRECTORY_SEPARATOR . $settings['theme'];
 
@@ -109,65 +93,6 @@ class Settings
 	}
 
 
-    # i18n
- 	public static function getLanguageLabels($language, $theme, $plugins)
-	{
-    	# if not present, set the English language
-    	if( empty($language) )
-    	{
-      		$language = 'en';
-    	}
-
-    	# loads the system strings of the set language
-		$yaml = new Models\WriteYaml();
-    	$system_labels = $yaml->getYaml('system' . DIRECTORY_SEPARATOR . 'author' . DIRECTORY_SEPARATOR . 'languages', $language . '.yaml');
-
-    	# loads the theme strings of the set language
-    	$theme_labels = [];
-    	$theme_language_folder = 'themes' . DIRECTORY_SEPARATOR . $theme . DIRECTORY_SEPARATOR . 'languages' . DIRECTORY_SEPARATOR;
-    	$theme_language_file = $language . '.yaml';
-    	if (file_exists($theme_language_folder . $theme_language_file))
-    	{
-      		$this_theme_labels = $yaml->getYaml($theme_language_folder, $theme_language_file);
-      		if(is_array($this_theme_labels))
-      		{
-	      		$theme_labels = $this_theme_labels;
-      		}
-    	}
-
-    	# loads the plugins strings of the set language
-    	$plugins_labels = [];
-    	if(!empty($plugins))
-    	{
-      		$plugin_labels = [];
-      		foreach($plugins as $name => $value)
-      		{
-        		$plugin_language_folder = 'plugins' . DIRECTORY_SEPARATOR . $name . DIRECTORY_SEPARATOR . 'languages' . DIRECTORY_SEPARATOR;
-        		$plugin_language_file = $language . '.yaml';
-
-        		if (file_exists($plugin_language_folder . $plugin_language_file))
-        		{
-        			$this_plugin_labels = $yaml->getYaml($plugin_language_folder, $plugin_language_file);
-        			if(is_array($this_plugin_labels))
-        			{
-	          			$plugin_labels[$name] = $this_plugin_labels;
-        			}
-        		}
-      		}
-
-      		foreach($plugin_labels as $key => $value)
-      		{
-        		$plugins_labels = array_merge($plugins_labels, $value);
-      		}
-    	}
-
-    	# Combines arrays of system languages, themes and plugins
-    	$labels = array_merge($system_labels, $theme_labels, $plugins_labels);
-
-		return $labels;
-    	
-    }
-
   	public function whichLanguage()
   	{
     	# Check which languages are available

+ 89 - 0
system/Translations.php

@@ -0,0 +1,89 @@
+<?php 
+
+namespace Typemill;
+
+class Translations
+{
+  public static function loadTranslations($environment)
+  {
+    define('DS', '/');
+    
+    $yaml = new Models\WriteYaml();
+    $settings = $yaml->getYaml('settings', 'settings.yaml');
+
+    if($settings === FALSE){
+      $language = \Typemill\Settings::whichLanguage();
+    } else {
+      $language = $settings['language'];
+    }
+
+    $theme = 'typemill';
+    if($settings !== NULL){
+      if(is_array($settings)){
+        if (array_key_exists('theme', $settings)) {
+          $theme = $settings['theme'];
+        }
+      }
+    }
+
+    // theme labels selected according to the environment: admin or user
+    $theme_labels = [];
+    $theme_language_folder = 'themes' . DS . $theme . DS . 'languages' . DS . $environment . DS;
+    $theme_language_file = $language . '.yaml';
+    if (file_exists($theme_language_folder . $theme_language_file))
+    {
+      $theme_labels = $yaml->getYaml($theme_language_folder, $theme_language_file);
+    }
+
+    $system_labels = [];
+    $plugins_labels = [];
+    if($environment=='admin'){
+      // system labels
+      $system_language_folder ='system' . DS . 'author' . DS . 'languages' . DS;
+      $system_language_file = $language . '.yaml';
+      if (file_exists($system_language_folder . $system_language_file))
+      {
+        $system_labels = $yaml->getYaml($system_language_folder, $system_language_file);
+      }
+
+      // Next change, to provide labels for the admin and user environments.
+      // There may be plugins that only work in the user environment,
+      // only in the admin environment, or in both environments.
+      $plugin_labels = [];
+      if($settings !== NULL){
+        if(is_array($settings)){
+          if (array_key_exists('plugins', $settings)) {
+            if($settings['plugins'] !== NULL) {
+              foreach($settings['plugins'] as $plugin => $config){
+                if($config['active']=='on'){
+                  $plugin_language_folder = 'plugins' . DS . $plugin . DS . 'languages' . DS;
+                  $plugin_language_file = $language . '.yaml';
+                  if (file_exists($plugin_language_folder . $plugin_language_file)){
+                    $plugin_labels[$plugin] = $yaml->getYaml($plugin_language_folder, $plugin_language_file);
+                  }
+                }
+              }
+              foreach($plugin_labels as $key => $value) {
+                $plugins_labels = array_merge($plugins_labels, $value);
+              }
+            }
+          }
+        }
+      }
+    }
+
+    $labels = [];
+    if(is_array($plugins_labels)){
+      $labels = array_merge($labels, $plugins_labels);
+    }
+    if(is_array($system_labels)){
+      $labels = array_merge($labels, $system_labels);
+    }
+    if(is_array($theme_labels)){
+      $labels = array_merge($labels, $theme_labels);
+    }
+
+    return $labels;
+  }
+
+}

+ 5 - 5
system/author/auth/setup.twig

@@ -1,5 +1,5 @@
 {% extends 'layouts/layoutAuth.twig' %}
-{% block title %}{{ labels['SETUP'] ? labels['SETUP'] : 'Setup' }}{% endblock %}
+{% block title %}{{ __('Setup') }}{% endblock %}
 
 {% block content %}
 
@@ -19,21 +19,21 @@
 
 				<fieldset class="auth">
 					<div class="formElement{{ errors.username ? ' errors' : '' }}">
-						<label for="username">{{ labels['USERNAME'] ? labels['USERNAME'] : 'Username' }} <abbr title="{{ labels['REQUIRED'] ? labels['REQUIRED'] : 'required' }}">*</abbr></label>
+						<label for="username">{{ __('Username') }} <abbr title="{{ __('required') }}">*</abbr></label>
 						<input type="text" name="username" value="{{ old.username }}" required>
 						{% if errors.username %}
 							<span class="error">{{ errors.username | first }}</span>
 						{% endif %}
 					</div>
 					<div class="formElement{{ errors.email ? ' errors' : '' }}">
-						<label for="email">{{ labels['E_MAIL'] ? labels['E_MAIL'] : 'E-Mail' }} <abbr title="{{ labels['REQUIRED'] ? labels['REQUIRED'] : 'required' }}">*</abbr></label>
+						<label for="email">{{ __('E-Mail') }} <abbr title="{{ __('required') }}">*</abbr></label>
 						<input type="text" name="email" value="{{ old.email }}" required>
 						{% if errors.email %}
 							<span class="error">{{ errors.email | first }}</span>
 						{% endif %}
 					</div>
 					<div class="formElement{{ errors.password ? ' errors' : '' }}">
-						<label for="password">{{ labels['PASSWORD'] ? labels['PASSWORD'] : 'Password' }} <abbr title="{{ labels['REQUIRED'] ? labels['REQUIRED'] : 'required' }}">*</abbr></label>
+						<label for="password">{{ __('Password') }} <abbr title="{{ __('required') }}">*</abbr></label>
 						<input type="password" name="password" required autocomplete="off">
 						{% if errors.password %}
 							<span class="error">{{ errors.password | first }}</span>
@@ -41,7 +41,7 @@
 					</div>
 				</fieldset>
 
-				<input type="submit" value="{{ labels['CREATE_USER'] ? labels['CREATE_USER'] : 'Create User' }}" />
+				<input type="submit" value="{{ __('Create User') }}" />
 				{{ csrf_field() | raw }}
 						
 			</form>

+ 13 - 13
system/author/auth/welcome.twig

@@ -1,6 +1,6 @@
 {% extends 'layouts/layoutAuth.twig' %}
 
-{% block title %}{{ labels['SW_SETUP_WELCOME'] ? labels['SW_SETUP_WELCOME'] : 'Setup Welcome' }}{% endblock %}
+{% block title %}{{ __('Setup Welcome') }}{% endblock %}
 
 {% block content %}
 		
@@ -8,37 +8,37 @@
 	
 		<div class="medium">
 			<div class="welcomeIntro">
-				<h1>{{ labels['SW_HURRA'] ? labels['SW_HURRA'] : 'Hurra' }}!</h1>
-				<p>{{ labels['SW_YOUR_ACCOUNT'] ? labels['SW_YOUR_ACCOUNT'] : 'Your account has been created and you are logged in now.'}}</p>
-				<p><strong>{{ labels['SW_NEXT_STOP'] ? labels['SW_NEXT_STOP'] : 'Next step:' }}</strong> {{ labels['SW_VISIT'] ? labels['SW_VISIT'] : 'Visit the author panel and setup your new website. You can configure the system, choose themes and add plugins.' }}</p>
-				<p><strong>{{ labels['SW_GET_HELP'] ? labels['SW_GET_HELP'] : 'Get help:' }}</strong> {{ labels['SW_IF_YOU_HAVE'] ? labels['SW_IF_YOU_HAVE'] : 'If you have any questions, please read the' }} <a target="_blank" href="https://typemill.net/typemill"><i class="icon-link-ext"></i> {{ labels['SW_DOCS'] ? labels['SW_DOCS'] : 'docs' }}</a> {{ labels['SW_OR_OPEN'] ? labels['SW_OR_OPEN'] : 'or open a new issue on' }} <a target="_blank" href="https://github.com/typemill/typemill"><i class="icon-link-ext"></i> {{ labels['GITHUB'] ? labels['GITHUB'] : 'github' }}</a>.</p>
-				<p>{{ labels['SW_CODED'] ? labels['SW_CODED'] : 'Coded with' }} <span style="font-size: 1.4em;color:#e0474c; margin:0px 3px">&#9829;</span> {{ labels['SW_BY'] ? labels['SW_BY'] : 'by the' }} <a target="_blank" href="https://github.com/typemill/typemill">{{ labels['SW_COMMUNITY'] ? labels['SW_COMMUNITY'] : 'community' }}</a> & <a target="_blank" href="https://trendschau.net/typemill-development"><i class="icon-link-ext"></i> {{ labels['SW_TRENDSCHAU'] ? labels['SW_TRENDSCHAU'] : 'Trendschau Digital' }}</a>.</p>
+				<h1>{{ __('Hurra') }}!</h1>
+				<p>{{ __('Your account has been created and you are logged in now.') }}</p>
+				<p><strong>{{ __('Next step') }}:</strong> {{ __('Visit the author panel and setup your new website. You can configure the system, choose themes and add plugins.') }}</p>
+				<p><strong>{{ __('Get help') }}:</strong> {{ __('If you have any questions, please read the') }} <a target="_blank" href="https://typemill.net/typemill"><i class="icon-link-ext"></i> {{ __('docs') }}</a> {{ __('or open a new issue on') }} <a target="_blank" href="https://github.com/typemill/typemill"><i class="icon-link-ext"></i> {{ __('github') }}</a>.</p>
+				<p>{{ __('Coded with') }} <span style="font-size: 1.4em;color:#e0474c; margin:0px 3px">&#9829;</span> {{ __('by the') }} <a target="_blank" href="https://github.com/typemill/typemill">{{ __('community') }}</a> & <a target="_blank" href="https://trendschau.net/typemill-development"><i class="icon-link-ext"></i> {{ __('Trendschau Digital') }}</a>.</p>
 			</div>
-			<a class="button" href="{{ path_for('settings.show') }}">{{ labels['SW_CONFIGURE'] ? labels['SW_CONFIGURE'] : 'Configure your website' }}</a>
+			<a class="button" href="{{ path_for('settings.show') }}">{{ __('Configure your website') }}</a>
  		</div>
 		
 		<div class="small">
 			<div class="welcomeCard">
 				<a href="{{ path_for('settings.show') }}">
 					<div class="welcomeInner">
-						<h3>{{ labels['SYSTEM'] ? labels['SYSTEM'] : 'System' }}</h3>
-						<p>{{ labels['SW_GIVE_YOUR_NEW'] ? labels['SW_GIVE_YOUR_NEW'] : 'Give your new website a name, add the author and choose a copyright.' }}</p>				
+						<h3>{{ __('System') }}</h3>
+						<p>{{ __('Give your new website a name, add the author and choose a copyright.') }}</p>				
 					</div>
 				</a>				
 			</div>
 			<div class="welcomeCard">
 				<a href="{{ path_for('themes.show') }}">
 					<div class="welcomeInner">
-						<h3>{{ labels['THEMES'] ? labels['THEMES'] : 'Themes' }}</h3>
-						<p>{{ labels['SW_CHOOSE_A_THEME'] ? labels['SW_CHOOSE_A_THEME'] : 'Choose a theme for your website and configure the theme details.' }}</p>
+						<h3>{{ __('Themes') }}</h3>
+						<p>{{ __('Choose a theme for your website and configure the theme details.') }}</p>
 					</div>
 				</a>
 			</div>
 			<div class="welcomeCard">
 				<a href="{{ path_for('plugins.show') }}">
 					<div class="welcomeInner">
-						<h3>{{ labels['PLUGINS'] ? labels['PLUGINS'] : 'Plugins' }}</h3>
-						<p>{{ labels['SW_ADD_NEW_FEATURE'] ? labels['SW_ADD_NEW_FEATURE'] : 'Add new features to your website with plugins and configure them.' }}</p>
+						<h3>{{ __('Plugins') }}</h3>
+						<p>{{ __('Add new features to your website with plugins and configure them.') }}</p>
 					</div>
 				</a>
 			</div>

+ 3 - 3
system/author/js/vue-shared.js

@@ -11,13 +11,13 @@ Vue.component('component-image', {
 					'<div class="w-50 ph3 lh-copy f6 relative">' +
 						'<div class="relative dib w-100">' +
 							'<input class="absolute o-0 w-100 top-0 z-1 pointer" type="file" name="image" accept="image/*" @change="onFileChange( $event )" /> ' +
-							'<p class="relative w-100 bn br1 bg-tm-green white pa3 ma0 tc"><svg class="icon icon-upload baseline"><use xlink:href="#icon-upload"></use></svg> upload an image</p>'+
+							'<p class="relative w-100 bn br1 bg-tm-green white pa3 ma0 tc"><svg class="icon icon-upload baseline"><use xlink:href="#icon-upload"></use></svg> {{ \'upload an image\'|translate }}</p>'+
 						'</div>' +
 						'<div class="dib w-100 mt3">' +
-							'<button class="w-100 pointer bn br1 bg-tm-green white pa3 ma0 tc" @click.prevent="openmedialib()"><svg class="icon icon-image baseline"><use xlink:href="#icon-image"></use></svg> select from medialib</button>' +
+							'<button class="w-100 pointer bn br1 bg-tm-green white pa3 ma0 tc" @click.prevent="openmedialib()"><svg class="icon icon-image baseline"><use xlink:href="#icon-image"></use></svg> {{ \'select from medialib\'|translate }}</button>' +
 						'</div>' +
 						'<div class="dib w-100 mt3">' +
-							'<label>Image URL (read only)</label>' +
+							'<label>{{ \'Image URL (read only)\'|translate }}</label>' +
 							'<div class="flex">' +
 								'<button @click.prevent="deleteImage()" class="w-10 bg-tm-gray bn hover-bg-tm-red hover-white">x</button>' +
 								'<input class="w-90" type="text"' + 

+ 17 - 17
system/author/languages/de.yaml

@@ -190,20 +190,20 @@ WRITING: Schreiben
 YEAR: Jahr
 YOU_CAN_OVERWRITE_THE_THEME_CSS_WITH_YOUR_OWN_CSS_HERE_: Du kannst das CSS des Themes hier überschreiben.
 
-SW_SETUP_WELCOME: Setup Willkommen
-SW_HURRA: Hurra
-SW_YOUR_ACCOUNT: Dein Account wurde erstellt und du bist jetzt angemeldet.
-SW_NEXT_STOP: Nächster Schritt:
-SW_VISIT: Besuche die Autorenoberfläche und richte die Seite ein. Du kannst das System konfigurieren, Themes auswählen and Plugins hinzufügen.
-SW_GET_HELP: Hilfe erhalten:
-SW_IF_YOU_HAVE: Wenn du Fragen hast, lies bitte die
-SW_DOCS: Dokumentation
-SW_OR_OPEN: oder öffne ein neues Issue
-SW_CODED: Entwickelt mit
-SW_BY: von der
-SW_COMMUNITY: Community
-SW_TRENDSCHAU: Trendschau Digital
-SW_CONFIGURE: Richte deine Seite ein.
-SW_GIVE_YOUR_NEW: Gib deiner neuen Seite einen Namen, füge Autoren hinzu und wähle ein Copyright.
-SW_CHOOSE_A_THEME: Richte ein Theme für deine Webseite ein.
-SW_ADD_NEW_FEATURE: Füge mit Plugins neue Funktionen hinzu.
+SETUP_WELCOME: Setup Willkommen
+HURRA: Hurra
+YOUR_ACCOUNT_HAS_BEEN_CREATED_AND_YOU_ARE_LOGGED_IN_NOW_: Dein Account wurde erstellt und du bist jetzt angemeldet.
+NEXT_STEP: Nächster Schritt:
+VISIT_THE_AUTHOR_PANEL_AND_SETUP_YOUR_NEW_WEBSITE__YOU_CAN_CONFIGURE_THE_SYSTEM__CHOOSE_THEMES_AND_ADD_PLUGINS_: Besuche die Autorenoberfläche und richte die Seite ein. Du kannst das System konfigurieren, Themes auswählen and Plugins hinzufügen.
+GET_HELP: Hilfe erhalten
+IF_YOU_HAVE_ANY_QUESTIONS__PLEASE_READ_THE: Wenn du Fragen hast, lies bitte die
+DOCS: Dokumentation
+OR_OPEN_A_NEW_ISSUE_ON: oder öffne ein neues Issue
+CODED_WITH: Entwickelt mit
+BY_THE: von der
+COMMUNITY: Community
+TRENDSCHAU_DIGITAL: Trendschau Digital
+CONFIGURE_YOUR_WEBSITE: Richte deine Seite ein.
+GIVE_YOUR_NEW_WEBSITE_A_NAME__ADD_THE_AUTHOR_AND_CHOOSE_A_COPYRIGHT_: Gib deiner neuen Seite einen Namen, füge Autoren hinzu und wähle ein Copyright.
+CHOOSE_A_THEME_FOR_YOUR_WEBSITE_AND_CONFIGURE_THE_THEME_DETAILS_: Richte ein Theme für deine Webseite ein.
+ADD_NEW_FEATURES_TO_YOUR_WEBSITE_WITH_PLUGINS_AND_CONFIGURE_THEM_: Füge mit Plugins neue Funktionen hinzu.

+ 22 - 17
system/author/languages/en.yaml

@@ -15,6 +15,7 @@ ADD_ROW_ABOVE: add row above
 ADD_ROW_BELOW: add row below
 ALL_USERS: All users
 ALT_TEXT: Alt-Text
+ALTERNATIVE_TEXT_FOR_THE_HERO_IMAGE: Alternative Text for the hero image
 AUTHOR: Author
 BACK_TO_STARTPAGE: back to startpage
 BOLD: bold
@@ -78,6 +79,7 @@ GOOGLE_SITEMAP: Google Sitemap
 HEAD: Head
 HEADLINE_ANCHORS: Headline Anchors
 HEADLINE: Headline
+HERO_IMAGE: Hero Image
 HIDE: Hide
 HIDE_PAGE_FROM_NAVIGATION: Hide page from navigation
 HOME: home
@@ -87,6 +89,7 @@ HR: hr
 IF_NOT_FILLED__THE_DESCRIPTION_IS_EXTRACTED_FROM_CONTENT_: If not filled, the description is extracted from content.
 IMAGE: Image
 IMAGES: Images
+IMAGE_URL__READ_ONLY_: Image URL (read only)
 ITALIAN: Italian
 ITALIC: italic
 LANGUAGE: Language
@@ -103,6 +106,7 @@ LOGO: Logo
 LOGOUT: Logout
 MANUAL_DATE: Manual date
 MARKDOWN: markdown
+MAXIMUM_SIZE_FOR_AN_IMAGE_IS_5_MB__HERO_IMAGES_ARE_NOT_SUPPORTED_BY_ALL_THEMES_: Maximum size for an image is 5 MB. Hero images are not supported by all themes.
 MENU: Menu
 META_DESCRIPTION: Meta description
 META: meta
@@ -168,6 +172,7 @@ ULIST: ulist
 UNKNOWN: Unknown
 UPDATE_USER: Update User
 UPLOAD_FILE: Upload a file
+UPLOAD_AN_IMAGE: upload an image
 UPLOAD: upload
 USE_2_TO_20_CHARACTERS: Use 2 to 20 characters.
 USE_2_TO_40_CHARACTERS: Use 2 to 40 characters.
@@ -191,20 +196,20 @@ WRITING: Writing
 YEAR: Year
 YOU_CAN_OVERWRITE_THE_THEME_CSS_WITH_YOUR_OWN_CSS_HERE_: You can overwrite the theme-css with your own css here.
 
-SW_SETUP_WELCOME: Setup Welcome
-SW_HURRA: Hurra
-SW_YOUR_ACCOUNT: Your account has been created and you are logged in now.
-SW_NEXT_STOP: Next step:
-SW_VISIT: Visit the author panel and setup your new website. You can configure the system, choose themes and add plugins.
-SW_GET_HELP: Get help:
-SW_IF_YOU_HAVE: If you have any questions, please read the
-SW_DOCS: docs
-SW_OR_OPEN: or open a new issue on
-SW_CODED: Coded with
-SW_BY: by the
-SW_COMMUNITY: community
-SW_TRENDSCHAU: Trendschau Digital
-SW_CONFIGURE: Configure your website
-SW_GIVE_YOUR_NEW: Give your new website a name, add the author and choose a copyright.
-SW_CHOOSE_A_THEME: Choose a theme for your website and configure the theme details.
-SW_ADD_NEW_FEATURE: Add new features to your website with plugins and configure them.
+SETUP_WELCOME: Setup Welcome
+HURRA: Hurra
+YOUR_ACCOUNT_HAS_BEEN_CREATED_AND_YOU_ARE_LOGGED_IN_NOW_: Your account has been created and you are logged in now.
+NEXT_STEP: Next step
+VISIT_THE_AUTHOR_PANEL_AND_SETUP_YOUR_NEW_WEBSITE__YOU_CAN_CONFIGURE_THE_SYSTEM__CHOOSE_THEMES_AND_ADD_PLUGINS_: Visit the author panel and setup your new website. You can configure the system, choose themes and add plugins.
+GET_HELP: Get help
+IF_YOU_HAVE_ANY_QUESTIONS__PLEASE_READ_THE: If you have any questions, please read the
+DOCS: docs
+OR_OPEN_A_NEW_ISSUE_ON: or open a new issue on
+CODED_WITH: Coded with
+BY_THE: by the
+COMMUNITY: community
+TRENDSCHAU_DIGITAL: Trendschau Digital
+CONFIGURE_YOUR_WEBSITE: Configure your website
+GIVE_YOUR_NEW_WEBSITE_A_NAME__ADD_THE_AUTHOR_AND_CHOOSE_A_COPYRIGHT_: Give your new website a name, add the author and choose a copyright.
+CHOOSE_A_THEME_FOR_YOUR_WEBSITE_AND_CONFIGURE_THE_THEME_DETAILS_: Choose a theme for your website and configure the theme details.
+ADD_NEW_FEATURES_TO_YOUR_WEBSITE_WITH_PLUGINS_AND_CONFIGURE_THEM_: Add new features to your website with plugins and configure them.

+ 17 - 17
system/author/languages/fr.yaml

@@ -189,20 +189,20 @@ WRITING: Rédaction
 YEAR: Année
 YOU_CAN_OVERWRITE_THE_THEME_CSS_WITH_YOUR_OWN_CSS_HERE_: Vous pouvez surcharger ici le css du thème avec vos propres styles.
 
-SW_SETUP_WELCOME: Bienvenue dans l'installation
-SW_HURRA: Hourrah
-SW_YOUR_ACCOUNT: Votre compte a été créé et vous êtes maintenant connecté
-SW_NEXT_STOP: Prochaine étape:
-SW_VISIT: Visitez le volet Auteur et configurez votre nouveau site. Vous pouvez paramétrer le système, choisir un thème et ajouter des plugins.
-SW_GET_HELP: Obtenir de l'aide:
-SW_IF_YOU_HAVE: Pour toutes questions, veuillez consulter la
-SW_DOCS: documentation
-SW_OR_OPEN: ou ouvrir un nouveau bug sur
-SW_CODED: Codé avec
-SW_BY: par
-SW_COMMUNITY: communauté
-SW_TRENDSCHAU: Trendschau Digital
-SW_CONFIGURE: Configurez votre site
-SW_GIVE_YOUR_NEW: Donnez un nom à votre nouveau site, ajouter un auteur et choisissez un copyright.
-SW_CHOOSE_A_THEME: Choisissez un thème pour votre site et configurez les details du thème.
-SW_ADD_NEW_FEATURE: Ajoutez de nouvelles fonctionnalités à votre site grâce aux plugins et configurez-les.
+SETUP_WELCOME: Bienvenue dans l'installation
+HURRA: Hourrah
+YOUR_ACCOUNT_HAS_BEEN_CREATED_AND_YOU_ARE_LOGGED_IN_NOW_: Votre compte a été créé et vous êtes maintenant connecté
+NEXT_STEP: Prochaine étape:
+VISIT_THE_AUTHOR_PANEL_AND_SETUP_YOUR_NEW_WEBSITE__YOU_CAN_CONFIGURE_THE_SYSTEM__CHOOSE_THEMES_AND_ADD_PLUGINS_: Visitez le volet Auteur et configurez votre nouveau site. Vous pouvez paramétrer le système, choisir un thème et ajouter des plugins.
+GET_HELP: Obtenir de l'aide:
+IF_YOU_HAVE_ANY_QUESTIONS__PLEASE_READ_THE: Pour toutes questions, veuillez consulter la
+DOCS: documentation
+OR_OPEN_A_NEW_ISSUE_ON: ou ouvrir un nouveau bug sur
+CODED_WITH: Codé avec
+BY_THE: par
+COMMUNITY: communauté
+TRENDSCHAU_DIGITAL: Trendschau Digital
+CONFIGURE_YOUR_WEBSITE: Configurez votre site
+GIVE_YOUR_NEW_WEBSITE_A_NAME__ADD_THE_AUTHOR_AND_CHOOSE_A_COPYRIGHT_: Donnez un nom à votre nouveau site, ajouter un auteur et choisissez un copyright.
+CHOOSE_A_THEME_FOR_YOUR_WEBSITE_AND_CONFIGURE_THE_THEME_DETAILS_: Choisissez un thème pour votre site et configurez les details du thème.
+ADD_NEW_FEATURES_TO_YOUR_WEBSITE_WITH_PLUGINS_AND_CONFIGURE_THEM_: Ajoutez de nouvelles fonctionnalités à votre site grâce aux plugins et configurez-les.

+ 23 - 18
system/author/languages/it.yaml

@@ -15,6 +15,7 @@ ADD_ROW_ABOVE: aggiungi la riga sopra
 ADD_ROW_BELOW: aggiungi la riga sotto
 ALL_USERS: Tutti gli utenti
 ALT_TEXT: Testo alternativo
+ALTERNATIVE_TEXT_FOR_THE_HERO_IMAGE: Testo alternativo per l'immagine hero
 AUTHOR: Autore
 BACK_TO_STARTPAGE: torna alla pagina iniziale
 BOLD: grassetto
@@ -78,6 +79,7 @@ GOOGLE_SITEMAP: Sitemap di Google
 HEAD: Intestazione
 HEADLINE_ANCHORS: Ancoraggi del titolo
 HEADLINE: Titolo
+HERO_IMAGE: Immagine Hero
 HIDE: Nascondi
 HIDE_PAGE_FROM_NAVIGATION: Nasconde la pagina dalla navigazione
 HOME: home
@@ -87,11 +89,12 @@ HR: Linea orizzontale
 IF_NOT_FILLED__THE_DESCRIPTION_IS_EXTRACTED_FROM_CONTENT_: Se non compilato, la descrizione viene estratta dal contenuto.
 IMAGE: Immagine
 IMAGES: Immagini
+IMAGE_URL__READ_ONLY_: Immagine URL (sola lettura)
 ITALIAN: Italiano
 ITALIC: corsivo
 LANGUAGE: Lingua
 LANGUAGE_ADMIN: Lingua (admin-ui)
-LANGUAGE_ATTR: Language Attribute (website)
+LANGUAGE_ATTR: Attributo Lingua (sito)
 LAST_MODIFIED_LIVE__READONLY_: Ultima modifica (sola lettura)
 LAST_NAME: Cognome
 LEFT: Sinistra
@@ -103,6 +106,7 @@ LOGO: Logo
 LOGOUT: Esci
 MANUAL_DATE: Data manuale
 MARKDOWN: Markdown
+MAXIMUM_SIZE_FOR_AN_IMAGE_IS_5_MB__HERO_IMAGES_ARE_NOT_SUPPORTED_BY_ALL_THEMES_: La dimensione massima per un'immagine è di 5 MB. Le immagini hero non sono supportate da tutti i temi.
 MENU: Menu
 META_DESCRIPTION: Descrizione
 META: Metadati
@@ -169,6 +173,7 @@ UNKNOWN: Ignoto
 UPDATE_USER: Aggiorna utente
 UPLOAD: carica
 UPLOAD_FILE: Carica un file
+UPLOAD_AN_IMAGE: carica un'immagine
 USE_2_TO_20_CHARACTERS: Usa da 2 a 20 caratteri.
 USE_2_TO_40_CHARACTERS: Usa da 2 a 40 caratteri.
 USE_A_VALID_LANGUAGE_ATTRIBUTE: Use a valid language attribute
@@ -191,20 +196,20 @@ WRITING: Scrittura
 YEAR: Anno
 YOU_CAN_OVERWRITE_THE_THEME_CSS_WITH_YOUR_OWN_CSS_HERE_: È possibile sovrascrivere il css del tema con il proprio CSS qui.
 
-SW_SETUP_WELCOME: Benvenuto all'installazione
-SW_HURRA: Evviva
-SW_YOUR_ACCOUNT: Il tuo account è stato creato e ora sei connesso.
-SW_NEXT_STOP: Prossimo passo:
-SW_VISIT: Visita il pannello autore e configura il tuo nuovo sito. Puoi configurare il sistema, scegliere i temi e aggiungere plugin.
-SW_GET_HELP: Chiedi aiuto:
-SW_IF_YOU_HAVE: In caso di domande, si prega di leggere la
-SW_DOCS: documentazione
-SW_OR_OPEN: o aprire un nuovo problema su
-SW_CODED: Codificato con
-SW_BY: dalla
-SW_COMMUNITY: comunità
-SW_TRENDSCHAU: Trendschau Digital
-SW_CONFIGURE: Configura il tuo sito
-SW_GIVE_YOUR_NEW: Dai un nome al tuo nuovo sito, aggiungi l'autore e scegli un diritto d'autore.
-SW_CHOOSE_A_THEME: Scegli un tema per il tuo sito e configura i dettagli del tema.
-SW_ADD_NEW_FEATURE: Aggiungi nuove funzionalità al tuo sito mediante plugin e configurali.
+SETUP_WELCOME: Benvenuto all'installazione
+HURRA: Evviva
+YOUR_ACCOUNT_HAS_BEEN_CREATED_AND_YOU_ARE_LOGGED_IN_NOW_: Il tuo account è stato creato e ora sei connesso.
+NEXT_STEP: Prossimo passo
+VISIT_THE_AUTHOR_PANEL_AND_SETUP_YOUR_NEW_WEBSITE__YOU_CAN_CONFIGURE_THE_SYSTEM__CHOOSE_THEMES_AND_ADD_PLUGINS_: Visita il pannello autore e configura il tuo nuovo sito. Puoi configurare il sistema, scegliere i temi e aggiungere plugin.
+GET_HELP: Chiedi aiuto
+IF_YOU_HAVE_ANY_QUESTIONS__PLEASE_READ_THE: In caso di domande, si prega di leggere la
+DOCS: documentazione
+OR_OPEN_A_NEW_ISSUE_ON: o aprire un nuovo problema su
+CODED_WITH: Codificato con
+BY_THE: dalla
+COMMUNITY: comunità
+TRENDSCHAU_DIGITAL: Trendschau Digital
+CONFIGURE_YOUR_WEBSITE: Configura il tuo sito
+GIVE_YOUR_NEW_WEBSITE_A_NAME__ADD_THE_AUTHOR_AND_CHOOSE_A_COPYRIGHT_: Dai un nome al tuo nuovo sito, aggiungi l'autore e scegli un diritto d'autore.
+CHOOSE_A_THEME_FOR_YOUR_WEBSITE_AND_CONFIGURE_THE_THEME_DETAILS_: Scegli un tema per il tuo sito e configura i dettagli del tema.
+ADD_NEW_FEATURES_TO_YOUR_WEBSITE_WITH_PLUGINS_AND_CONFIGURE_THEM_: Aggiungi nuove funzionalità al tuo sito mediante plugin e configurali.

+ 1 - 1
system/author/layouts/layoutBlox.twig

@@ -205,7 +205,7 @@
 		<script>
 			let formatConfig = {{ settings.formats|json_encode() }};
       		let language = {{ settings.language|json_encode() }};
-      		let labels = {{ settings.labels|json_encode() }};
+          let labels = {{ translations|json_encode() }};
       		let navigation = {{ navigation|json_encode() }};
 		</script>
 

+ 1 - 1
system/author/layouts/layoutEditor.twig

@@ -96,7 +96,7 @@
 
 	    <script>
     	  	let language = {{ settings.language|json_encode() }};
-          	let labels = {{ settings.labels|json_encode() }};
+            let labels = {{ translations|json_encode() }};
       		let navigation = {{ navigation|json_encode() }};
 		</script>
     

+ 18 - 3
system/system.php

@@ -203,9 +203,6 @@ $container['view'] = function ($container)
 	$view->addExtension(new Typemill\Extensions\TwigMetaExtension());	
 	$view->addExtension(new Typemill\Extensions\TwigPagelistExtension());	
 
-        // i18n
-	$view->addExtension(new Typemill\Extensions\TwigLanguageExtension( $container->get('settings')['labels'] ));
-
 	/* use {{ base_url() }} in twig templates */
 	$view['base_url']	 = $container['request']->getUri()->getBaseUrl();
 	$view['current_url'] = $container['request']->getUri()->getPath();
@@ -220,6 +217,24 @@ $container['view'] = function ($container)
 	/* add asset-function to all views */
 	$view->getEnvironment()->addGlobal('assets', $container->assets);
 
+
+/******************************
+* LOAD TRANSLATIONS           *
+******************************/
+  $uri = $_SERVER['REQUEST_URI'];
+  if(isset($uri) && (strpos($uri,'/tm/') !== false OR strpos($uri,'/setup') !== false))
+  {
+    // Admin environment labels
+    $labels = Typemill\Translations::loadTranslations('admin');
+  } else {
+    // User environment labels
+    // For now it is useless, but it will prove useful in the future
+    $labels = Typemill\Translations::loadTranslations('user');
+  }
+  $container['translations'] = $labels;
+  $view['translations'] = $labels;
+  $view->addExtension(new Typemill\Extensions\TwigLanguageExtension( $labels ));
+
 	return $view;
 };
 

+ 2 - 2
themes/typemill/cover.twig

@@ -19,10 +19,10 @@
 		{{ content }}
 		
 		<div class="actionLink">
-			<a href="{{ navigation[0].urlRel }}">{{ settings.themes.typemill.start ? settings.themes.typemill.start : __('Start')}}</a>
+			<a href="{{ navigation[0].urlRel }}">{{ settings.themes.typemill.start ? settings.themes.typemill.start : 'Start' }}</a>
 			
 			{% if settings.setup  %}
-				<a href="{{ base_url }}/setup">{{ __('Setup') }}</a>
+				<a href="{{ base_url }}/setup">Setup</a>
 			{% endif %}
 		</div>
 	</div>