In this tutorial we will only have one properties file. However, in real-world projects, you would have a separate file for each supported language with a suffix for the locale, for example i18n_de.properties for German, i18n_en.properties for English, and so on. When a user runs the ...
The metadata is loaded only once when cache is activatedAnnotations<?php namespace Entity; use Gedmo\Mapping\Annotation as Gedmo; use Doctrine\ORM\Mapping as ORM; use Gedmo\Translatable\Translatable; /** * @ORM\Table(name="articles") * @ORM\Entity */ class Article implements Translatable { ...
$locales = TranslatableUtility::get_content_languages();// there's no need to show a navigation when there's less than 2 languages. So return nullif(count($locales) <2) {returnnull; } $currentLocale =Translatable::get_current_locale(); $homeTranslated =null;if($home = SiteTree::get_b...
The designers of MF1 made it clear in the syntax what content needs to be translated, and what doesn't. Any text occurring inside curly braces is non-translatable: for example, the string "number" in the last set of curly braces doesn't mean the word "number", but rather, is a dire...
As mentioned above, by translating the document to which the button describing the link for the translating unit12has been allocated by the implementor himself, only the document having the declaration intention of the translation permission can be translated. It is possible to prevent the document ...
<?php $article = new Entity\Article; $article->setTitle('my title in en'); $article->setContent('my content in en'); $em->persist($article); $em->flush();This inserted an article and inserted the translations for it in "en_us" locale only if en_us is not the default locale ...