ProcessWire - Multilanguage Website: Unterschied zwischen den Versionen
Aus Wikizone
| Zeile 34: | Zeile 34: | ||
=== Variablen in i18n === | === Variablen in i18n === | ||
| + | $out = sprintf(__("Created %d pages."), $count); | ||
$out = sprintf(__('Your city is %1$s, and your zip code is %2$s.'), $city, $zipcode); | $out = sprintf(__('Your city is %1$s, and your zip code is %2$s.'), $city, $zipcode); | ||
Version vom 22. April 2019, 09:21 Uhr
Mehrsprachige Websites mit ProcessWire / Andere Default Sprache
- https://processwire.com/talk/topic/5518-multi-language-site/
- http://processwire.com/api/multi-language-support/multi-language-urls/
- https://processwire.com/talk/topic/9322-change-default-language-for-homepage/ (Modul Solution)
Deutsch als Default Sprache
- Enable languages support -> Core Module "Language Support" aktivieren. -> Languages stehen im Backend Setup zur Verfügung
- Titel der Default Sprache anpassen (z.B. Deutsch (default) )
- Language Pack in der default Sprache installieren -> Dies ist ab jetzt die Default Sprache. Nicht vergessen auch den lang Tag im Header zu setzen, damit der Browser die Sprache richtig erkennt.
Weitere Sprachen
- Für weitere Sprachen entsprechend hinzufügen.
drop in the none english language pack (for admin backend) into the default language, (e.g. german langpack)
add a new language to it and drop in a language pack for any none english language or simply don't drop in a language pack to get the english version (but not as the default one!) As a nice sideeffect every new user in your system gets the native language per default without have it to select from the list.
So, yes, this is no solution if you once have set it up and need to switch the default language afterwards, but just want to note it.
Beispiel Default Sprache Deutsch
Todo Testen
- Modul Language Support
- Translation File unter Setup Sprachen hochladen
- Übersetzungen von Hand hinzufügen
Templates für Multilanguage vorbereiten (i18n)
https://processwire.com/docs/multi-language-support/code-i18n/
$out = $this->_("Live long and prosper"); // syntax within a class
$out = __("Live long and prosper!"); // syntax outside of a class
Dann im Backend unter der Sprache "Find files to translate" und die Template Datei auswählen.
Variablen in i18n
$out = sprintf(__("Created %d pages."), $count);
$out = sprintf(__('Your city is %1$s, and your zip code is %2$s.'), $city, $zipcode);