Page History
...
Here is the yaml template definition file:
Code Pro | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
templateScript: /foobar/templates/pages/dilberts-page.ftl renderType: freemarker visible: true dialog: foobar:pages/dilberts-page-properties #title: foobar.customlabels.page.dilbert.title |
- The key for the
title
property is created automatically by Magnolia, you do not have to provide it. In fact Magnolia will recognize two keys, one with module name and one without it:
foobar.templates.pages.dilberts-page
templates.pages.dilberts-page
- Line 5: If desired, you can assign a custom key.
...
Note that Magnolia provides many so called "generic keys" which are already translated and which may fit to your items. See generic i18n keys and their list for further details.
Key generators
...
Code Pro | ||||||
---|---|---|---|---|---|---|
| ||||||
@I18nable(keyGenerator = RenderableDefinitionKeyGenerator.class) public interface RenderableDefinition extends NamedDefinition { String getId(); @Override String getName(); String getRenderType(); @I18nText String getTitle(); @I18nText String getDescription(); @Deprecated String getI18nBasename(); String getTemplateScript(); Map<String, RenderableDefinition> getVariations(); } |
- Line 1:
annotation specifies the key generator class.Javadoc 0 info.magnolia.i18nsystem.I18nable - Lines 11, 14:
annotation marks methods that return text which should be translated.Javadoc 0 info.magnolia.i18nsystem.I18nText
Info | ||||||||
---|---|---|---|---|---|---|---|---|
Use
|
From From Magnolia 6.2.1, any method annotated with
Javadoc | ||
---|---|---|
|
@I18nText(fallback = "")
if NO_FALLBACK
by default if no translation is found.Code Block | ||||
---|---|---|---|---|
| ||||
public @interface I18nText { /** * Without {@link #fallback()} explicitly specified, {@link info.magnolia.i18nsystem.TranslationServiceImpl} use the longest i18n key if translation key is not found as fallback. */ String NO_FALLBACK = "<no-fallback>"; /** * @return Value to be used if no translation is found. */ String fallback() default NO_FALLBACK; } |
SimpleTranslator – using i18n in Java classes
...
Overview
Content Tools