From a753f96b12dd65f033637c8834d52b6445d2e2cd Mon Sep 17 00:00:00 2001 From: "severoiuliano@gmail.com" <severoiuliano@gmail.com> Date: Thu, 9 Jan 2020 15:46:20 +0100 Subject: [PATCH] i18n-light on 1.3.1 --- cache/lastCache.txt | 2 +- settings/languages/en.yaml | 101 +++++++++++++++++++ settings/languages/it.yaml | 101 +++++++++++++++++++ system/Extensions/TwigLanguageExtension.php | 53 ++++++++++ system/Settings.php | 23 +++++ system/author/auth/login.twig | 14 +-- system/author/editor/editor-blox.twig | 2 +- system/author/editor/editor-raw.twig | 6 +- system/author/editor/publish-controller.twig | 22 ++-- system/author/partials/aside.twig | 16 +-- system/author/partials/editorNavi.twig | 12 +-- system/author/partials/navi.twig | 10 +- system/author/settings/plugins.twig | 24 ++--- system/author/settings/system.twig | 36 +++---- system/author/settings/themes.twig | 22 ++-- system/author/settings/user.twig | 32 +++--- system/author/settings/userlist.twig | 8 +- system/author/settings/usernew.twig | 22 ++-- system/system.php | 5 +- themes/typemill/cover.twig | 4 +- 20 files changed, 398 insertions(+), 117 deletions(-) create mode 100644 settings/languages/en.yaml create mode 100644 settings/languages/it.yaml create mode 100644 system/Extensions/TwigLanguageExtension.php diff --git a/cache/lastCache.txt b/cache/lastCache.txt index 5c17eb9..4e98754 100644 --- a/cache/lastCache.txt +++ b/cache/lastCache.txt @@ -1 +1 @@ -1577899842 \ No newline at end of file +1578580890 \ No newline at end of file diff --git a/settings/languages/en.yaml b/settings/languages/en.yaml new file mode 100644 index 0000000..b06f608 --- /dev/null +++ b/settings/languages/en.yaml @@ -0,0 +1,101 @@ +# English +ACCOUNT: Account +ACTIVE: Active +ACTUAL_PASSWORD: Actual Password +ADD_FILE: add file +ADD_FOLDER: add folder +ADD_FOLDER_TO_BASE_LEVEL: add folder to base level +ADD_ITEM: add item +ALL_USERS: All users +AUTHOR: Author +BACK_TO_STARTPAGE: back to startpage +BY: by +CODE: code +CONTENT: Content +COPYRIGHT: Copyright +CREATE_NEW_USER: Create New User +CREATE_USER: Create User +DEFINITION: definition +DELETE: delete +DELETE_PAGE: Delete page +DELETE_USER: Delete User +DISCARD_CHANGES: Discard Changes +DISCARD: Discard +DO_YOU_REALLY_WANT_TO_DELETE_THE_USER: Do you really want to delete the user +DO_YOU_REALLY_WANT_TO_DELETE_THIS_PAGE: Do you really want to delete this page? +DO_YOU_WANT_TO_DISCARD_YOUR_CHANGES_AND_SET_THE_CONTENT_BACK_TO_THE_LIVE_VERSION: Do you want to discard your changes and set the content back to the live version? +DRAFT: Draft +EDIT: edit +EDIT_USER: Edit User +E_G_: e.g. +E_MAIL: E-Mail +FIRST_NAME: First Name +FORGOT_PASSWORD: Forgot password +HEADLINE: headline +HOMEPAGE: Homepage +HR: hr +IMAGE: image +LANGUAGE: Language +LAST_NAME: Last Name +LICENCE: Licence +LOGIN: Login +LOGOUT: Logout +MARKDOWN: markdown +MENU: Menu +META_TITLE: meta title +MISSING_REQUIREMENTS: Missing Requirements +NEW_PASSWORD: New Password +NO_DESCRIPTION: No description +NO_PREVIEW: No Preview +NO_SETTINGS: No Settings +NOT_EDITABLE: not editable +OLIST: olist +ONLY_THE_FOLLOWING_SPECIAL_CHARACTERS_ARE_ALLOWED: Only the following special characters are allowed: +PASSWORD: Password +PLEASE_CONFIRM: Please confirm +PLUGINS: Plugins +PLUGIN_STORE: Plugin Store +PUBLISH: Publish +QUOTE: quote +RAW_CONTENT_EDITOR: Raw Content Editor +RAW_MARKDOWN_EDITOR: Raw Markdown Editor +RAW_MODE: raw mode +RAW: raw +READONLY: Readonly +REMEMBER_TO_BOOKMARK_THIS_PAGE: Remember to bookmark this page +REQUIRED: Required +ROLE: Role +SAVE_ALL_SETTINGS: Save All Settings +SAVE: Save +SAVE_THEME: Save Theme +SETTINGS: Settings +SETUP: Setup +STANDARD_EDITOR_MODE: Standard Editor Mode +START: Start +SYSTEM: System +TABLE: table +THE_FORMAT_BUTTONS: The Format Buttons +THEMES: Themes +THEME_STORE: Theme Store +TITLE: Title +TOC: toc +ULIST: ulist +UNKNOWN: Unknown +UPDATE_USER: Update User +USE_2_TO_40_CHARACTERS: Use 2 to 40 characters. +USE_A_VALID_YEAR: Use a valid year +USERNAME: Username +USERS: Users +USER: User +VIDEO: video +VIEW_SITE: View Site +VISUAL_CONTENT_EDITOR: Visual Content Editor +VISUAL_EDITOR: Visual Editor +VISUAL_MARKDOWN_EDITOR: Visual Markdown Editor +VISUAL_MODE: visual mode +VISUAL: visual +WAIT: wait +WEBSITE_TITLE: Website Title +WEB: Web +WRITING: Writing +YEAR: Year \ No newline at end of file diff --git a/settings/languages/it.yaml b/settings/languages/it.yaml new file mode 100644 index 0000000..3d90b2c --- /dev/null +++ b/settings/languages/it.yaml @@ -0,0 +1,101 @@ +# Italiano +ACCOUNT: Utenza +ACTIVE: Attivo +ACTUAL_PASSWORD: Parola d'ordine corrente +ADD_FILE: aggiungi file +ADD_FOLDER: aggiungi cartella +ADD_FOLDER_TO_BASE_LEVEL: aggiungi cartella al livello base +ADD_ITEM: aggiungi articolo +ALL_USERS: Tutti gli utenti +AUTHOR: Autore +BACK_TO_STARTPAGE: torna alla pagina iniziale +BY: di +CODE: codice +CONTENT: Contenuto +COPYRIGHT: Diritti d'autore +CREATE_NEW_USER: Crea nuovo utente +CREATE_USER: Crea utente +DEFINITION: elenco di definizioni +DELETE: elimina +DELETE_PAGE: Elimina pagina +DELETE_USER: Elimina utente +DISCARD_CHANGES: Non salvare le modifiche +DISCARD: Scarta +DO_YOU_REALLY_WANT_TO_DELETE_THE_USER: Vuoi veramente eliminare l'utente +DO_YOU_REALLY_WANT_TO_DELETE_THIS_PAGE: Vuoi veramente cancellare questa pagina? +DO_YOU_WANT_TO_DISCARD_YOUR_CHANGES_AND_SET_THE_CONTENT_BACK_TO_THE_LIVE_VERSION: Vuoi annullare le modifiche e ripristinare i contenuti alla versione precedente? +DRAFT: Bozza +EDIT: modifica +EDIT_USER: Modifica utente +E_G_: per es.: +E_MAIL: Posta elettronica +FIRST_NAME: Nome +FORGOT_PASSWORD: Parola d'ordine dimenticata +HEADLINE: titolo +HOMEPAGE: Homepage +HR: linea orizzontale +IMAGE: immagine +LANGUAGE: Lingua +LAST_NAME: Cognome +LICENCE: Licenza +LOGIN: Accesso +LOGOUT: Disconnessione +MARKDOWN: markdown +MENU: Menu +META_TITLE: meta titolo +MISSING_REQUIREMENTS: Requisiti mancanti +NEW_PASSWORD: Nuova parola d'ordine +NO_DESCRIPTION: Nessuna descrizione +NO_PREVIEW: Nessuna anteprima +NO_SETTINGS: Nessuna impostazione +NOT_EDITABLE: non modificabile +OLIST: elenchi ordinati +ONLY_THE_FOLLOWING_SPECIAL_CHARACTERS_ARE_ALLOWED: Sono ammessi solo i seguenti caratteri speciali: +PASSWORD: Parola d'ordine +PLEASE_CONFIRM: Per favore conferma +PLUGINS: Plugin +PLUGIN_STORE: Deposito plugin +PUBLISH: Pubblica +QUOTE: citazione +RAW_CONTENT_EDITOR: Editore contenuto grezzo +RAW: grezzo +RAW_MARKDOWN_EDITOR: Editore grezzo Markdown +RAW_MODE: modo grezzo +READONLY: Sola lettura +REMEMBER_TO_BOOKMARK_THIS_PAGE: Ricorda di aggiungere questa pagina ai segnalibri +REQUIRED: Richiesto +ROLE: Ruolo +SAVE_ALL_SETTINGS: Salva tutte le impostazioni +SAVE: Salva +SAVE_THEME: Salva tema +SETTINGS: Impostazioni +SETUP: Configurazione +STANDARD_EDITOR_MODE: Modalità editore standard +START: Comincia +SYSTEM: Sistema +TABLE: tabella +THE_FORMAT_BUTTONS: pulsanti di formattazione +THEMES: Temi +THEME_STORE: Deposito temi +TITLE: Titolo +TOC: sommario +ULIST: elenchi non ordinati +UNKNOWN: Ignoto +UPDATE_USER: Aggiorna utente +USE_2_TO_40_CHARACTERS: Usa da 2 a 40 caratteri. +USE_A_VALID_YEAR: Usa un anno valido +USERNAME: Nome utente +USERS: Utenti +USER: Utente +VIDEO: video +VIEW_SITE: Mostra sito +VISUAL_CONTENT_EDITOR: Editore contenuto visivo +VISUAL_EDITOR: Editore visivo +VISUAL_MARKDOWN_EDITOR: Editore visivo Markdown +VISUAL_MODE: modo visivo +VISUAL: visivo +WAIT: aspetta +WEBSITE_TITLE: Titolo del sito +WEB: Sito +WRITING: Scrittura +YEAR: Anno \ No newline at end of file diff --git a/system/Extensions/TwigLanguageExtension.php b/system/Extensions/TwigLanguageExtension.php new file mode 100644 index 0000000..4fc9fda --- /dev/null +++ b/system/Extensions/TwigLanguageExtension.php @@ -0,0 +1,53 @@ +<?php + +namespace Typemill\Extensions; + +use Typemill\Models\WriteYaml; + +class TwigLanguageExtension extends \Twig_Extension +{ + protected $labels; + + public function __construct($labels) + { + $this->labels = $labels; + } + + public function getFilters() + { + return [ + new \Twig_SimpleFilter('__', [$this,'translate'] ) + ]; + } + + public function getFunctions() + { + return [ + new \Twig_SimpleFunction('__', array($this, 'translate' )) + ]; + } + + public function translate( $label ) + { + // replaces spaces, dots and dash with underscores + $string = str_replace(" ", "_", $label); + $string = str_replace(".", "_", $string); + $string = str_replace("-", "_", $string); + + // transforms to uppercase + $string = strtoupper( $string ); + + //translates the string + $translated_label = $this->labels[$string]; + + // if the string is not present, set the original string + if( empty($translated_label) ){ + $translated_label = $label; + } + + // returns the string in the set language + return $translated_label; + + } + +} diff --git a/system/Settings.php b/system/Settings.php index 661dbac..e3c245c 100644 --- a/system/Settings.php +++ b/system/Settings.php @@ -16,6 +16,12 @@ class Settings $settings = array_merge($defaultSettings, $userSettings); } + // i18n + // load the strings of the set language + $language = $settings['language']; + $settings['labels'] = self::getLanguageLabels($language); + + # We know the used theme now so create the theme path $settings['themePath'] = $settings['rootPath'] . $settings['themeFolder'] . DIRECTORY_SEPARATOR . $settings['theme']; @@ -70,6 +76,23 @@ class Settings return $userSettings; } + + // i18n + public static function getLanguageLabels($language) + { + // if not present, set the English language + if( empty($language) ){ + $language = 'en'; + } + + // load the strings of the set language + $yaml = new Models\WriteYaml(); + $labels = $yaml->getYaml('settings/languages', $language.'.yaml'); + + return $labels; + } + + public static function getObjectSettings($objectType, $objectName) { $yaml = new Models\WriteYaml(); diff --git a/system/author/auth/login.twig b/system/author/auth/login.twig index 10e618b..476db36 100644 --- a/system/author/auth/login.twig +++ b/system/author/auth/login.twig @@ -6,21 +6,21 @@ <div class="setupWrapper"> <div class="setupContent"> - <p><svg class="icon baseline icon-bookmark-o"><use xlink:href="#icon-bookmark-o"></use></svg>Remember to bookmark this page</p> + <p><svg class="icon baseline icon-bookmark-o"><use xlink:href="#icon-bookmark-o"></use></svg>{{ __('Remember to bookmark this page') }}</p> </div> <div class="authformWrapper"> <form method="POST" action="{{ path_for("auth.login") }}" autocomplete="off"> <fieldset class="auth"> <div class="formElement{{ errors.username ? ' errors' : '' }}"> - <label for="username">Username <abbr title="required">*</abbr></label> + <label for="username">{{ __('Username') }} <abbr title="{{ __('required') }}">*</abbr></label> <input type="text" name="username" value="{{ old.username }}" required> {% if errors.signup_username %} <span class="error">{{ errors.username | first }}</span> {% endif %} </div> <div class="formElement{{ errors.password ? ' errors' : '' }}"> - <label for="password">Password <abbr title="required">*</abbr></label> + <label for="password">{{ __('Password') }} <abbr title="{{ __('required') }}">*</abbr></label> <input type="password" name="password" required autoomplete="off"> {% if errors.password %} <span class="error">{{ errors.password | first }}</span> @@ -29,18 +29,18 @@ </fieldset> <div class="loginarea" id="loginarea"> - <input type="submit" value="Login" id="loginbutton" class="loginbutton" /> + <input type="submit" value="{{ __('Login') }}" id="loginbutton" class="loginbutton" /> {{ csrf_field() | raw }} {% if messages.time %} - <div id="counter" class="counter">wait <span id="wait">{{ messages.time }}</span> sec</div> - <div class="forgotpw"><a href="https://typemill.net/writers/forgot-password" target="_blank">Forgot password?</a></div> + <div id="counter" class="counter">{{ __('wait') }} <span id="wait">{{ messages.time }}</span> sec</div> + <div class="forgotpw"><a href="https://typemill.net/writers/forgot-password" target="_blank">{{ __('Forgot password') }}?</a></div> {% endif %} </div> </form> </div> <div class="setupContent"> - <p><a href="{{ base_url() }}">back to startpage</a></p> + <p><a href="{{ base_url() }}">{{ __('back to startpage') }}</a></p> </div> </div> <footer></footer> diff --git a/system/author/editor/editor-blox.twig b/system/author/editor/editor-blox.twig index cb4560e..c7a8579 100644 --- a/system/author/editor/editor-blox.twig +++ b/system/author/editor/editor-blox.twig @@ -1,5 +1,5 @@ {% extends 'layouts/layoutBlox.twig' %} -{% block title %}Visual Content Editor{% endblock %} +{% block title %}{{ __('Visual Content Editor') }}{% endblock %} {% block content %} diff --git a/system/author/editor/editor-raw.twig b/system/author/editor/editor-raw.twig index 22a8d8d..3a93ede 100644 --- a/system/author/editor/editor-raw.twig +++ b/system/author/editor/editor-raw.twig @@ -1,5 +1,5 @@ {% extends 'layouts/layoutEditor.twig' %} -{% block title %}Raw Content Editor{% endblock %} +{% block title %}{{ __('Raw Content Editor') }}{% endblock %} {% block content %} @@ -33,12 +33,12 @@ <fieldset> <div class="large" :class="{'error' : errors.title}"> - <label for="title">Title*</label> + <label for="title">{{ __('Title') }}*</label> <input @input="changeContent" id="title" name="title" type="text" v-model="form.title" value="{{title}}" required /> <span class="error" v-if="errors.title">${ errors.title }</span> </div> <div class="large" :class="{'error' : errors.content}"> - <label for="content">Content*</label> + <label for="content">{{ __('Content') }}*</label> <textarea id="content" v-model="form.content" @input="changeContent" required>{{ content }}</textarea> <span class="error" v-if="errors.content">${ errors.content }</span> </div> diff --git a/system/author/editor/publish-controller.twig b/system/author/editor/publish-controller.twig index 39a3ec4..10bfaf5 100644 --- a/system/author/editor/publish-controller.twig +++ b/system/author/editor/publish-controller.twig @@ -1,12 +1,12 @@ <div class="editor buttonset" id="publishController" data-published="{{ item.published }}" data-drafted="{{ item.drafted }}" v-cloak> <div v-if="errors.message" class="message error">${ errors.message }</div> - <button v-if="raw" @click.prevent="saveDraft" id="draft" :class="draftResult" :disabled="draftDisabled"><span class="desktop">Save </span>Draft</button><button @click.prevent="publishDraft" id="publish" :class="publishResult" :disabled="publishDisabled">Publish</button> - <button @click.prevent="showModal('discard')" v-if="visual && !publishStatus" id="discard" :class="discardResult" :disabled="publishDisabled">Discard</button> + <button v-if="raw" @click.prevent="saveDraft" id="draft" :class="draftResult" :disabled="draftDisabled"><span class="desktop">{{ __('Save') }} </span>{{ __('Draft') }}</button><button @click.prevent="publishDraft" id="publish" :class="publishResult" :disabled="publishDisabled">{{ __('Publish') }}</button> + <button @click.prevent="showModal('discard')" v-if="visual && !publishStatus" id="discard" :class="discardResult" :disabled="publishDisabled">{{ __('Discard') }}</button> <div class="secondary"> <button @click.prevent="depublishArticle" class="button--secondary" :disabled="publishStatus"><span class="desktop">${publishLabel}</span><span class="mobile">${publishLabelMobile}</span></button> - <button @click.prevent="showModal('delete')" class="button--secondary danger"><span class="desktop">delete</span><span class="mobile">X</span></button> - <a v-if="visual" href="{{ base_url }}/tm/content/raw{{item.urlRelWoF}}" class="button--secondary"><span class="desktop">raw mode</span><span class="mobile">raw</span></a> - <a v-if="raw" href="{{ base_url }}/tm/content/visual{{item.urlRelWoF}}" class="button--secondary"><span class="desktop">visual mode</span><span class="mobile">visual</span></a> + <button @click.prevent="showModal('delete')" class="button--secondary danger"><span class="desktop">{{ __('delete') }}</span><span class="mobile">X</span></button> + <a v-if="visual" href="{{ base_url }}/tm/content/raw{{item.urlRelWoF}}" class="button--secondary"><span class="desktop">{{ __('raw mode') }}</span><span class="mobile">{{ __('raw') }}</span></a> + <a v-if="raw" href="{{ base_url }}/tm/content/visual{{item.urlRelWoF}}" class="button--secondary"><span class="desktop">{{ __('visual mode') }}</span><span class="mobile">{{ __('visual') }}</span></a> <a target="_blank" class="button--secondary" href="{{ item.urlAbs }}"><svg class="icon baseline icon-external-link"><use xlink:href="#icon-external-link"></use></svg></a> </div> <transition name="fade"> @@ -14,14 +14,14 @@ <div class="modalInner"> <div @click="hideModal" id="closeModal" class="closeModal">X</div> <div v-if="modalType == 'delete'"> - <h2>Delete page</h2> - <p>Do you really want to delete this page? Please confirm.</p> - <button @click.prevent="deleteArticle" class="large alert" :class="deleteResult" :disabled="deleteDisabled">Delete Page</button> + <h2>{{ __('Delete page') }}</h2> + <p>{{ __('Do you really want to delete this page') }} {{ __('Please confirm') }}</p> + <button @click.prevent="deleteArticle" class="large alert" :class="deleteResult" :disabled="deleteDisabled">{{ __('Delete Page') }}</button> </div> <div v-if="modalType == 'discard'"> - <h2>Discard Changes</h2> - <p>Do you want to discard your changes and set the content back to the live version?</p> - <button @click.prevent="discardDraft" class="large fullwidth" :class="discardResult" :disabled="publishDisabled">Discard Changes</button> + <h2>{{ __('Discard Changes') }}</h2> + <p>{{ __('Do you want to discard your changes and set the content back to the live version') }}</p> + <button @click.prevent="discardDraft" class="large fullwidth" :class="discardResult" :disabled="publishDisabled">{{ __('Discard Changes') }}</button> </div> </div> </div> diff --git a/system/author/partials/aside.twig b/system/author/partials/aside.twig index 5723cc5..a82d368 100644 --- a/system/author/partials/aside.twig +++ b/system/author/partials/aside.twig @@ -1,16 +1,16 @@ <nav id="sidebar-menu" class="sidebar-menu"> {% if is_role('administrator') %} - <div id="mobile-menu" class="menu-action">Menu <span class="button-arrow"></span></div> - <h3>Settings</h3> + <div id="mobile-menu" class="menu-action">{{ __('Menu') }} <span class="button-arrow"></span></div> + <h3>{{ __('Settings') }}</h3> <ul class="menu-list margin-bottom"> - <li class="menu-item"><a href="{{ path_for('settings.show') }}"{{ (route == 'settings.show') ? ' class="active"' : '' }}>System</a></li> - <li class="menu-item"><a href="{{ path_for('themes.show') }}"{{ (route == 'themes.show') ? ' class="active"' : '' }}>Themes</a></li> - <li class="menu-item"><a href="{{ path_for('plugins.show') }}"{{ (route == 'plugins.show') ? ' class="active"' : '' }}>Plugins</a></li> + <li class="menu-item"><a href="{{ path_for('settings.show') }}"{{ (route == 'settings.show') ? ' class="active"' : '' }}>{{ __('System') }}</a></li> + <li class="menu-item"><a href="{{ path_for('themes.show') }}"{{ (route == 'themes.show') ? ' class="active"' : '' }}>{{ __('Themes') }}</a></li> + <li class="menu-item"><a href="{{ path_for('plugins.show') }}"{{ (route == 'plugins.show') ? ' class="active"' : '' }}>{{ __('Plugins') }}</a></li> </ul> - <h3>Users</h3> + <h3>{{ __('Users') }}</h3> <ul class="menu-list"> - <li class="menu-item"><a href="{{ path_for('user.list') }}"{{ (route == 'user.list') ? ' class="active"' : '' }}>All users</a></li> - <li class="menu-item"><a href="{{ path_for('user.new') }}"{{ (route == 'user.new') ? ' class="active"' : '' }}>Create user</a></li> + <li class="menu-item"><a href="{{ path_for('user.list') }}"{{ (route == 'user.list') ? ' class="active"' : '' }}>{{ __('All users') }}</a></li> + <li class="menu-item"><a href="{{ path_for('user.new') }}"{{ (route == 'user.new') ? ' class="active"' : '' }}>{{ __('Create user') }}</a></li> {% for user in users %} <li class="menu-item"><a href="{{ path_for('user.show', {'username' : user }) }}"{{ (username == user) ? ' class="active"' : '' }}>{{ user }}</a></li> {% endfor %} diff --git a/system/author/partials/editorNavi.twig b/system/author/partials/editorNavi.twig index d1cfd07..014d49c 100644 --- a/system/author/partials/editorNavi.twig +++ b/system/author/partials/editorNavi.twig @@ -1,11 +1,11 @@ <nav id="sidebar-menu" class="sidebar-menu--content"> <div id="data-navi" data-navi='{{ navigation|json_encode() }}' data-homepage='{{ homepage|json_encode() }}' data-editormode="{{settings.editor}}"></div> - <div id="mobile-menu" class="menu-action">Menu <span class="button-arrow"></span></div> + <div id="mobile-menu" class="menu-action">{{ __('Menu') }} <span class="button-arrow"></span></div> <div id="navi" class="content-navi" v-model="freeze" v-cloak> <div class="navi-list"> <div class="navi-item folder"> <div class="status" :class="homepage.status"></div> - <a href="{{ base_url }}/tm/content/{{ settings.editor }}" :class="homepage.active"><span><span class="iconwrapper"><svg class="icon icon-home"><use xlink:href="#icon-home"></use></svg></span><span class="level-1">Homepage</span></a> + <a href="{{ base_url }}/tm/content/{{ settings.editor }}" :class="homepage.active"><span><span class="iconwrapper"><svg class="icon icon-home"><use xlink:href="#icon-home"></use></svg></span><span class="level-1">{{ __('Homepage') }}</span></a> </div> </div> <draggable class="navi-list" tag="ul" @@ -40,12 +40,12 @@ <svg class="icon icon-plus"><use xlink:href="#icon-plus"></use></svg> </span> <span class="addNaviItem"> - <a class="addNaviLink" href="#" @click.prevent="toggleForm">add item</a> + <a class="addNaviLink" href="#" @click.prevent="toggleForm">{{ __('add item') }}</a> </span> <transition name="fade"> <div v-if="showForm" class="addNaviForm"> <input v-model="newItem"> - <button class="b-left" @click="addFile('file')">add file</button><button class="b-right" @click="addFile('folder')">add folder</button> + <button class="b-left" @click="addFile('file')">{{ __('add file') }}</button><button class="b-right" @click="addFile('folder')">{{ __('add folder') }}</button> </div> </transition> </li> @@ -90,12 +90,12 @@ <svg class="icon icon-plus"><use xlink:href="#icon-plus"></use></svg> </span> <span :class="getLevel(level + '.0')" class="addNaviItem"> - <a class="addNaviLink" href="#" @click.prevent="toggleForm">add item</a> + <a class="addNaviLink" href="#" @click.prevent="toggleForm">{% endverbatim %}{{ __('add item') }}{% verbatim %}</a> </span> <transition name="fade"> <div v-if="showForm" class="addNaviForm"> <input v-model="newItem"> - <button class="b-left" @click="addFile('file')">add file</button><button class="b-right" @click="addFile('folder')">add folder</button> + <button class="b-left" @click="addFile('file')">{% endverbatim %}{{ __('add file') }}{% verbatim %}</button><button class="b-right" @click="addFile('folder')">{% endverbatim %}{{ __('add folder') }}{% verbatim %}</button> </div> </transition> </li> diff --git a/system/author/partials/navi.twig b/system/author/partials/navi.twig index cebdb1e..ea293c5 100644 --- a/system/author/partials/navi.twig +++ b/system/author/partials/navi.twig @@ -3,13 +3,13 @@ <a href="{{ base_url }}/tm/content/{{ settings.editor }}">Typemill</a> </div> <ul class="navi-items"> - <li><a href="{{ base_url }}/tm/content/{{ settings.editor }}"{{ navigation ? ' class="active"' : '' }}><svg class="icon baseline icon-file-text-o"><use xlink:href="#icon-file-text-o"></use></svg><span class="nav-label"> Content</span></a></li><li> + <li><a href="{{ base_url }}/tm/content/{{ settings.editor }}"{{ navigation ? ' class="active"' : '' }}><svg class="icon baseline icon-file-text-o"><use xlink:href="#icon-file-text-o"></use></svg><span class="nav-label"> {{ __('Content') }}</span></a></li><li> {% if is_role('administrator') %} - <a href="{{ path_for('settings.show') }}"{{ users ? ' class="active"' : '' }}><svg class="icon baseline icon-cog"><use xlink:href="#icon-cog"></use></svg><span class="nav-label"> Settings</span></a></li><li> + <a href="{{ path_for('settings.show') }}"{{ users ? ' class="active"' : '' }}><svg class="icon baseline icon-cog"><use xlink:href="#icon-cog"></use></svg><span class="nav-label"> {{ __('Settings') }}</span></a></li><li> {% else %} - <a href="{{ path_for('user.show', {'username' : get_username() }) }}"{{ users ? ' class="active"' : '' }}><svg class="icon icon-cog baseline"><use xlink:href="#icon-cog, gear"></use></svg><span class="nav-label"> Account</span></a></li><li> + <a href="{{ path_for('user.show', {'username' : get_username() }) }}"{{ users ? ' class="active"' : '' }}><svg class="icon icon-cog baseline"><use xlink:href="#icon-cog, gear"></use></svg><span class="nav-label"> {{ __('Account') }}</span></a></li><li> {% endif %} - <a href="{{ base_url }}"><svg class="icon baseline icon-external-link"><use xlink:href="#icon-external-link"></use></svg><span class="nav-label"> View Site</span></a></li><li> - <a href="{{ path_for('auth.logout') }}"><svg class="icon baseline icon-power-off"><use xlink:href="#icon-power-off"></use></svg><span class="nav-label"> Logout</span></a></li> + <a href="{{ base_url }}"><svg class="icon baseline icon-external-link"><use xlink:href="#icon-external-link"></use></svg><span class="nav-label"> {{ __('View Site') }}</span></a></li><li> + <a href="{{ path_for('auth.logout') }}"><svg class="icon baseline icon-power-off"><use xlink:href="#icon-power-off"></use></svg><span class="nav-label"> {{ __('Logout') }}</span></a></li> </ul> </nav> \ No newline at end of file diff --git a/system/author/settings/plugins.twig b/system/author/settings/plugins.twig index 8644c83..8a6db8b 100644 --- a/system/author/settings/plugins.twig +++ b/system/author/settings/plugins.twig @@ -1,5 +1,5 @@ {% extends 'layouts/layout.twig' %} -{% block title %}Setup{% endblock %} +{% block title %}{{ __('Setup') }}{% endblock %} {% set startpage = old.settings.startpage ? old.settings.startpage : settings.startpage %} {% block content %} @@ -11,8 +11,8 @@ <section id="plugins" class="plugins"> <header class="headline"> - <h1>Plugins</h1> - <a class="button" target="_blank" href="https://plugins.typemill.net">Plugin Store</a> + <h1>{{ __('Plugins') }}</h1> + <a class="button" target="_blank" href="https://plugins.typemill.net">{{ __('Plugin Store') }}</a> </header> {% for pluginName,plugin in plugins %} @@ -22,22 +22,22 @@ <header> <legend>{{ pluginName }}</legend> <div class="cardActive"> - <label class="control-group">Active + <label class="control-group">{{ __('Active') }} <input type="checkbox" class="fc-active" name="{{pluginName}}[active]"{% if settings.plugins[pluginName].active %} checked {% endif %}> <span class="checkmark"></span> </label> </div> </header> - <div id="{{ pluginName }}" class="fc-plugin-version update-banner">{{ plugin.version ? plugin.version : 'Unknown' }}</div> + <div id="{{ pluginName }}" class="fc-plugin-version update-banner">{{ plugin.version ? plugin.version : __('Unknown') }}</div> <div class="cardDescPlugin"> - <p>{{ plugin.description ? plugin.description : 'No description' }}</p> + <p>{{ plugin.description ? plugin.description : __('No description') }}</p> <ul class="cardInfo"> - <li>{{ plugin.version ? plugin.version : 'Unknown' }}</li><li> - {{ plugin.licence ? plugin.licence : 'Unkown' }}</li><li> - by {{ plugin.author ? plugin.author : 'Unknown' }}</li>{% if plugin.homepage %}<li> - <a href="{{ plugin.homepage}}" target="blank">Web</a></li>{% endif %} + <li>{{ plugin.version ? plugin.version : __('Unknown') }}</li><li> + {{ plugin.licence ? plugin.licence : __('Unkown') }}</li><li> + by {{ plugin.author ? plugin.author : __('Unknown') }}</li>{% if plugin.homepage %}<li> + <a href="{{ plugin.homepage}}" target="blank">{{ __('Web') }}</a></li>{% endif %} </ul> </div> <div class="cardInner cardFields{{ errors[pluginName] ? ' open' : '' }}"> @@ -62,7 +62,7 @@ {% endfor %} </div> - <button type="button" class="plugin-button fc-settings{{ settings.plugins[pluginName].active ? ' active' : '' }}{{ plugin.forms.fields|length > 0 ? ' has-settings' : ' no-settings'}}">{{ plugin.forms.fields|length > 0 ? 'Settings <span class="button-arrow"></span>' : ' '}}</button> + <button type="button" class="plugin-button fc-settings{{ settings.plugins[pluginName].active ? ' active' : '' }}{{ plugin.forms.fields|length > 0 ? ' has-settings' : ' no-settings'}}">{{ plugin.forms.fields|length > 0 ? __('Settings') ~ ' <span class="button-arrow"></span>' : ' '}}</button> </div> </fieldset> @@ -71,7 +71,7 @@ </section> - <input type="submit" value="Save All Settings" /> + <input type="submit" value="{{ __('Save All Settings') }}" /> {{ csrf_field() | raw }} diff --git a/system/author/settings/system.twig b/system/author/settings/system.twig index 09c24d2..548af63 100644 --- a/system/author/settings/system.twig +++ b/system/author/settings/system.twig @@ -1,5 +1,5 @@ {% extends 'layouts/layout.twig' %} -{% block title %}Setup{% endblock %} +{% block title %}{{ __('Setup') }}{% endblock %} {% set startpage = old.settings.startpage ? old.settings.startpage : settings.startpage %} {% set linebreaks = old.settings.linebreaks ? old.settings.linebreaks : settings.linebreaks %} {% set year = settings.year ? settings.year : "now"|date("Y") %} @@ -15,7 +15,7 @@ <section id="system" class="settings"> <header class="headline"> - <h1>System <span class="version-number">v. {{settings.version}}</span></h1> + <h1>{{ __('System') }} <span class="version-number">v. {{settings.version}}</span></h1> </header> <div id="typemill" class="fc-system-version update-banner">{{ settings.version ? settings.version : 'Unknown' }}</div> @@ -23,19 +23,19 @@ <fieldset> <div class="medium{{ errors.settings.title ? ' error' : '' }}"> - <label for="settings[title]">Website Title *</label> + <label for="settings[title]">{{ __('Website Title') }} *</label> <input type="text" name="settings[title]" id="title" pattern=".{2,20}" required title="Use 2 to 20 characters." value="{{ old.settings.title ? old.settings.title : settings.title }}" /> {% if errors.settings.title %} <span class="error">{{ errors.settings.title | first }}</span> {% endif %} </div><div class="medium{{ errors.settings.author ? ' error' : '' }}"> - <label for="settings[author]">Author</label> - <input type="text" name="settings[author]" id="author" pattern="[^()/><\]\{\}\?\$@#!*%§=[\\\x22;:|]{2,40}" value="{{ old.settings.author ? old.settings.author : settings.author }}" title="Use 2 to 40 characters. Only the following special characters are allowed: a,b a.b a-b a_b a&b a+b" /> + <label for="settings[author]">{{ __('Author') }}</label> + <input type="text" name="settings[author]" id="author" pattern="[^()/><\]\{\}\?\$@#!*%§=[\\\x22;:|]{2,40}" value="{{ old.settings.author ? old.settings.author : settings.author }}" title="{{ __('Use 2 to 40 characters') }} {{ __('Only the following special characters are allowed') }} a,b a.b a-b a_b a&b a+b" /> {% if errors.settings.author %} <span class="error">{{ errors.settings.author | first }}</span> {% endif %} </div><div class="medium{{ errors.settings.copyright ? ' error' : '' }}"> - <label for="settings[copyright]">Copyright/Licence</label> + <label for="settings[copyright]">{{ __('Copyright') }}/{{ __('Licence') }}</label> <select name="settings[copyright]" id="copyright"> {% for copy in copyright %} <option value="{{ copy }}"{% if copy == old.settings.copyright or copy == mycopy %} selected{% endif %}>{{ copy }}</option> @@ -45,13 +45,13 @@ <span class="error">{{ errors.settings.copyright | first }}</span> {% endif %} </div><div class="medium{{ errors.settings.year ? ' error' : '' }}"> - <label for="settings[year]">Year *</label> - <input type="text" name="settings[year]" id="year" value="{{ old.settings.year ? old.settings.year : year }}" pattern="[0-9]{4}" required title="Use a valid year, e.g. 2017" /> + <label for="settings[year]">{{ __('Year') }} *</label> + <input type="text" name="settings[year]" id="year" value="{{ old.settings.year ? old.settings.year : year }}" pattern="[0-9]{4}" required title="{{ __('Use a valid year') }}, {{ __('e.g.') }} 2017" /> {% if errors.settings.year %} <span class="error">{{ errors.settings.year | first }}</span> {% endif %} </div><div class="medium{{ errors.settings.language ? ' error' : '' }}"> - <label for="settings[language]">Language-Attribute <small>(HTML)</small></label> + <label for="settings[language]">{{ __('Language') }}</label> <select name="settings[language]" id="language"> {% for key,lang in languages %} <option value="{{ key }}"{% if (key == old.settings.language or key == mylang) %} selected{% endif %}>{{ lang }}</option> @@ -61,20 +61,20 @@ <span class="error">{{ errors.settings.language | first }}</span> {% endif %} </div><div class="medium"> - <label for="settings[sitemap]">Google Sitemap <small>(Readonly)</small></label> + <label for="settings[sitemap]">Google Sitemap <small>({{ __('Readonly') }})</small></label> <input type="text" name="settings[sitemap]" id="sitemap" readonly value="{{ base_url }}/cache/sitemap.xml" /> </div> <hr> <header class="headline"> - <h2>Writing</h2> + <h2>{{ __('Writing') }}</h2> </header> <div class="medium{{ errors.settings.editor ? ' error' : '' }}"> - <label for="settings[editor]">Standard Editor Mode *</label> - <label class="control-group">Visual Markdown Editor + <label for="settings[editor]">{{ __('Standard Editor Mode') }} *</label> + <label class="control-group">{{ __('Visual Markdown Editor') }} <input name="settings[editor]" value="visual" type="radio" {% if (old.settings.editor == "visual") or (settings.editor == "visual") %} checked {% endif %}> <span class="radiomark"></span> </label> - <label class="control-group">Raw Markdown Editor + <label class="control-group">{{ __('Raw Markdown Editor') }} <input name="settings[editor]" value="raw" type="radio" {% if (old.settings.editor == "raw") or (settings.editor == "raw") %} checked {% endif %}> <span class="radiomark"></span> </label> @@ -83,11 +83,11 @@ {% endif %} </div> <div class="medium{{ errors.settings.editor ? ' error' : '' }}"> - <label>Visual Editor: The Format Buttons</label> + <label>{{ __('Visual Editor') }}: {{ __('The Format Buttons') }}</label> {% for format in formats %} - <label class="control-group">{{ format }} - <input name="settings[formats][]" value="{{ format }}" type="checkbox" {% if format in settings.formats %} checked {% endif %}> + <label class="control-group">{{ __(format) }} + <input name="settings[formats][]" value="{{ __('format') }}" type="checkbox" {% if format in settings.formats %} checked {% endif %}> <span class="checkmark"></span> </label> @@ -95,7 +95,7 @@ </div> </fieldset> </section> - <input type="submit" value="Save All Settings" /> + <input type="submit" value="{{ __('Save All Settings') }}" /> {{ csrf_field() | raw }} diff --git a/system/author/settings/themes.twig b/system/author/settings/themes.twig index c3c1e8d..0f7ad5e 100644 --- a/system/author/settings/themes.twig +++ b/system/author/settings/themes.twig @@ -1,5 +1,5 @@ {% extends 'layouts/layout.twig' %} -{% block title %}Setup{% endblock %} +{% block title %}{{ __('Setup') }}{% endblock %} {% set startpage = old.settings.startpage ? old.settings.startpage : settings.startpage %} {% block content %} @@ -9,8 +9,8 @@ <section id="themes" class="themes"> <header class="headline"> - <h1>Themes</h1> - <a class="button" target="_blank" href="https://themes.typemill.net">Theme Store</a> + <h1>{{ __('Themes') }}</h1> + <a class="button" target="_blank" href="https://themes.typemill.net">{{ __('Theme Store') }}</a> </header> {% for themeName, theme in themes %} @@ -24,20 +24,20 @@ {% if theme.img %} <img src="{{ base_url() }}/themes/{{themeName}}/{{themeName}}.jpg" /> {% else %} - <div class="no-preview">No Preview</div> + <div class="no-preview">{{ __('No Preview') }}</div> {% endif %} <div class="cardContent"> - <div id="{{ themeName }}" class="fc-theme-version update-banner">{{ theme.version ? theme.version : 'Unknown' }}</div> + <div id="{{ themeName }}" class="fc-theme-version update-banner">{{ theme.version ? theme.version : __('Unknown') }}</div> <div class="cardDescription"> <h2>{{ themeName }}</h2> <p>{{ theme.description }}</p> <ul class="cardInfo"> - <li>{{ theme.version ? theme.version : 'Unknown' }}</li><li> - {{ theme.licence ? theme.licence : 'Unkown' }}</li><li> - by {{ theme.author ? theme.author : 'Unknown' }}</li>{% if theme.homepage %}<li> - <a href="{{ theme.homepage}}" target="blank">Web</a></li>{% endif %} + <li>{{ theme.version ? theme.version : __('Unknown') }}</li><li> + {{ theme.licence ? theme.licence : __('Unkown') }}</li><li> + by {{ theme.author ? theme.author : __('Unknown') }}</li>{% if theme.homepage %}<li> + <a href="{{ theme.homepage}}" target="blank">{{ __('Web') }}</a></li>{% endif %} </ul> </div> </div> @@ -68,10 +68,10 @@ <input type="hidden" name="theme" value="{{ themeName }}"> <div class="medium"> - <button type="button" id="{{themeName}}-toggle" class="theme-button fc-settings{{ (settings.theme == themeName) ? ' active' : '' }}{{ theme.forms.fields|length > 0 ? ' has-settings' : ' no-settings'}}">{{ theme.forms.fields|length > 0 ? 'Settings <span class="button-arrow"></span>' : 'No Settings'}}</button> + <button type="button" id="{{themeName}}-toggle" class="theme-button fc-settings{{ (settings.theme == themeName) ? ' active' : '' }}{{ theme.forms.fields|length > 0 ? ' has-settings' : ' no-settings'}}">{{ theme.forms.fields|length > 0 ? __('Settings') ~ ' <span class="button-arrow"></span>' : __('No Settings')}}</button> </div> <div class="medium"> - <input type="submit" id="{{themeName}}-submit" value="Save Theme" /> + <input type="submit" id="{{themeName}}-submit" value="{{ __('Save Theme') }}" /> </div> </div> </div> diff --git a/system/author/settings/user.twig b/system/author/settings/user.twig index 391267a..4b3989f 100644 --- a/system/author/settings/user.twig +++ b/system/author/settings/user.twig @@ -1,5 +1,5 @@ {% extends 'layouts/layout.twig' %} -{% block title %}User{% endblock %} +{% block title %}{{ __('User') }}{% endblock %} {% block content %} @@ -10,13 +10,13 @@ <section id="user" class="settings"> <header class="headline"> - <h1>Edit User</h1> + <h1>{{ __('Edit User') }}</h1> </header> <fieldset class="auth"> <div class="large{{ errors.username ? ' errors' : '' }}"> - <label for="username">Username <small>(not editable)</small></label> + <label for="username">{{ __('Username') }} <small>({{ __('not editable') }})</small></label> <input type="text" name="showusername" value="{{ old.username ? old.username : userdata.username }}" required disabled> <input type="hidden" name="username" value="{{ userdata.username }}"> {% if errors.username %} @@ -25,7 +25,7 @@ </div> <div class="large{{ errors.firstname ? ' errors' : '' }}"> - <label for="firstname">First Name</label> + <label for="firstname">{{ __('First Name') }}</label> <input type="text" name="firstname" value="{{ old.firstname ? old.firstname : userdata.firstname }}"> {% if errors.firstname %} <span class="error">{{ errors.firstname | first }}</span> @@ -33,7 +33,7 @@ </div> <div class="large{{ errors.lastname ? ' errors' : '' }}"> - <label for="lastname">Last Name</label> + <label for="lastname">{{ __('Last Name') }}</label> <input type="text" name="lastname" value="{{ old.lastname ? old.lastname : userdata.lastname }}"> {% if errors.lastname %} <span class="error">{{ errors.lastname | first }}</span> @@ -41,7 +41,7 @@ </div> <div class="large{{ errors.email ? ' errors' : '' }}"> - <label for="email">E-Mail <abbr title="required">*</abbr></label> + <label for="email">{{ __('E-Mail') }} <abbr title="{{ __('required') }}">*</abbr></label> <input type="text" name="email" value="{{ old.email ? old.email : userdata.email }}" required> {% if errors.email %} <span class="error">{{ errors.email | first }}</span> @@ -50,7 +50,7 @@ {% if is_role('administrator') %} <div class="large{{ errors.userrole ? ' errors' : '' }}"> - <label for="userrole">Role <abbr title="required">*</abbr></label> + <label for="userrole">{{ __('Role') }} <abbr title="{{ __('required') }}">*</abbr></label> <select name="userrole" required> {% for role in userrole %} <option value="{{ role }}"{% if (role == old.userrole or role == userdata.userrole) %} selected{% endif %}>{{ role }}</option> @@ -63,16 +63,16 @@ {% endif %} <div class="large{{ errors.password ? ' errors' : '' }}"> - <label for="password">Actual Password</label> - <input type="password" name="password" autocomplete="off"> + <label for="password">{{ __('Actual Password') }}</label> + <input type="password" name="password"> {% if errors.password %} <span class="error">{{ errors.password | first }}</span> {% endif %} </div> <div class="large{{ errors.newpassword ? ' errors' : '' }}"> - <label for="newpassword">New Password</label> - <input type="password" name="newpassword" autocomplete="off"> + <label for="newpassword">{{ __('New Password') }}</label> + <input type="password" name="newpassword"> {% if errors.newpassword %} <span class="error">{{ errors.newpassword | first }}</span> {% endif %} @@ -81,11 +81,11 @@ </fieldset> </section> - <input type="submit" value="Update User" /> + <input type="submit" value="{{ __('Update User') }}" /> {{ csrf_field() | raw }} <div class="actionLink"> - <a href="#" id="openModal" class="openModal">Delete User</a> + <a href="#" id="openModal" class="openModal">{{ __('Delete User') }}</a> </div> </form> </div> @@ -94,8 +94,8 @@ <div class="modalInner"> <div id="closeModal" class="closeModal">X</div> <form method="POST" action="{{ path_for('user.delete') }}"> - <h2>Delete {{ userdata.username }}</h2> - <p>Do you really want to delete the user {{userdata.username}}? Please confirm.</p> + <h2>{{ __('Delete') }} {{ userdata.username }}</h2> + <p>{{ __('Do you really want to delete the user') }} {{userdata.username}}? {{ __('Please confirm') }}.</p> <input type="hidden" name="username" value="{{userdata.username}}"> <input type="submit" class="danger" value="Delete user"> {{ csrf_field() | raw }} @@ -104,4 +104,4 @@ </div> -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/system/author/settings/userlist.twig b/system/author/settings/userlist.twig index 698f1ac..e117d30 100644 --- a/system/author/settings/userlist.twig +++ b/system/author/settings/userlist.twig @@ -1,5 +1,5 @@ {% extends 'layouts/layout.twig' %} -{% block title %}User{% endblock %} +{% block title %}{{ __('User') }}{% endblock %} {% block content %} @@ -8,7 +8,7 @@ <section id="users" class="settings"> <header class="headline"> - <h1>All Users</h1> + <h1>{{ __('All Users') }}</h1> </header> <ul class="userlist"> @@ -19,7 +19,7 @@ <li class="col username">{{ user.username }} </li><li class="col userrole">{{ user.userrole }} </li><li class="col email">{{ user.email }} - </li><li class="col edit"><a href="{{ path_for('user.show', {'username' : user.username }) }}">edit</a></li> + </li><li class="col edit"><a href="{{ path_for('user.show', {'username' : user.username }) }}">{{ __('edit') }}</a></li> </ul> </li> @@ -27,7 +27,7 @@ </ul> <div class="medium"> - <a class="button" href="{{ path_for('user.new') }}">Create New User</a> + <a class="button" href="{{ path_for('user.new') }}">{{ __('Create New User') }}</a> </div> </section> diff --git a/system/author/settings/usernew.twig b/system/author/settings/usernew.twig index 0e103b9..34ba311 100644 --- a/system/author/settings/usernew.twig +++ b/system/author/settings/usernew.twig @@ -1,5 +1,5 @@ {% extends 'layouts/layout.twig' %} -{% block title %}User{% endblock %} +{% block title %}{{ __('User') }}{% endblock %} {% block content %} @@ -10,13 +10,13 @@ <section id="new-user" class="settings"> <header class="headline"> - <h1>Create New User</h1> + <h1>{{ __('Create New User') }}</h1> </header> <fieldset class="auth"> <div class="large{{ errors.username ? ' errors' : '' }}"> - <label for="username">Username <abbr title="required">*</abbr></label> + <label for="username">{{ __('Username') }} <abbr title="{{ __('required') }}">*</abbr></label> <input type="text" name="username" value="{{ old.username ? old.username : '' }}" required> {% if errors.username %} <span class="error">{{ errors.username | first }}</span> @@ -24,7 +24,7 @@ </div> <div class="large{{ errors.firstname ? ' errors' : '' }}"> - <label for="firstname">First Name</label> + <label for="firstname">{{ __('First Name') }}</label> <input type="text" name="firstname" value="{{ old.firstname ? old.firstname : userdata.firstname }}"> {% if errors.firstname %} <span class="error">{{ errors.firstname | first }}</span> @@ -32,7 +32,7 @@ </div> <div class="large{{ errors.lastname ? ' errors' : '' }}"> - <label for="lastname">Last Name</label> + <label for="lastname">{{ __('Last Name') }}</label> <input type="text" name="lastname" value="{{ old.lastname ? old.lastname : userdata.lastname }}"> {% if errors.lastname %} <span class="error">{{ errors.lastname | first }}</span> @@ -40,7 +40,7 @@ </div> <div class="large{{ errors.email ? ' errors' : '' }}"> - <label for="email">E-Mail <abbr title="required">*</abbr></label> + <label for="email">{{ __('E-Mail') }} <abbr title="{{ __('required') }}">*</abbr></label> <input type="text" name="email" value="{{ old.email ? old.email : '' }}" required> {% if errors.email %} <span class="error">{{ errors.email | first }}</span> @@ -48,7 +48,7 @@ </div> <div class="large{{ errors.userrole ? ' errors' : '' }}"> - <label for="userrole">Role <abbr title="required">*</abbr></label> + <label for="userrole">{{ __('Role') }} <abbr title="{{ __('required') }}">*</abbr></label> <select name="userrole" required> {% for role in userrole %} <option value="{{ role }}"{% if (role == old.userrole) %} selected{% endif %}>{{ role }}</option> @@ -60,8 +60,8 @@ </div> <div class="large{{ errors.password ? ' errors' : '' }}"> - <label for="password">Password <abbr title="required">*</abbr></label> - <input type="password" name="password" autocomplete="off" required> + <label for="password">{{ __('Password') }} <abbr title="{{ __('required') }}">*</abbr></label> + <input type="password" name="password" required> {% if errors.password %} <span class="error">{{ errors.password | first }}</span> {% endif %} @@ -70,10 +70,10 @@ </fieldset> </section> - <input type="submit" value="Create User" /> + <input type="submit" value="{{ __('Create User') }}" /> {{ csrf_field() | raw }} </form> </div> -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/system/system.php b/system/system.php index 109c8a0..f82f40d 100644 --- a/system/system.php +++ b/system/system.php @@ -202,7 +202,10 @@ $container['view'] = function ($container) $view->addExtension(new Typemill\Extensions\TwigUserExtension()); $view->addExtension(new Typemill\Extensions\TwigMarkdownExtension()); $view->addExtension(new Typemill\Extensions\TwigMetaExtension()); - + + // 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(); diff --git a/themes/typemill/cover.twig b/themes/typemill/cover.twig index 1a10959..4e58657 100644 --- a/themes/typemill/cover.twig +++ b/themes/typemill/cover.twig @@ -9,10 +9,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>