|
Errai 3.0.1-SNAPSHOT | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.google.gwt.core.ext.Generator
org.jboss.errai.config.rebind.AbstractAsyncGenerator
org.jboss.errai.ui.rebind.TranslationServiceGenerator
public class TranslationServiceGenerator
Generates a concrete subclass of TranslationService
. This class is responsible for
scanning the classpath for all bundles, and then making them available during template
translation.
The TranslationService
can also be used directly in the Errai application by injecting
it. This allows translated strings to be used from Errai Java code, not just from templates.
Constructor Summary | |
---|---|
TranslationServiceGenerator()
|
Method Summary | |
---|---|
String |
generate(com.google.gwt.core.ext.TreeLogger logger,
com.google.gwt.core.ext.GeneratorContext context)
Called by AbstractAsyncGenerator.generateAsync(TreeLogger, GeneratorContext) to carry out the actual code
generation. |
String |
generate(com.google.gwt.core.ext.TreeLogger logger,
com.google.gwt.core.ext.GeneratorContext context,
String typeName)
|
protected static void |
generateI18nHelperFilesInto(Map<String,Set<String>> discoveredI18nMap,
Map<String,String> translationKeyFieldMap,
File destDir)
Generates all helper files that developers can use to assist with i18n work. |
static String |
getLocaleFromBundlePath(String bundlePath)
Gets the locale information from the given bundle path. |
protected static void |
recordBundleKeys(Map<String,Set<String>> discoveredI18nMap,
String locale,
String bundlePath)
Records all of the i18n keys found in the given bundle. |
Methods inherited from class org.jboss.errai.config.rebind.AbstractAsyncGenerator |
---|
generateAsync, startAsyncGeneratorsAndWaitFor |
Methods inherited from class com.google.gwt.core.ext.Generator |
---|
escape |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public TranslationServiceGenerator()
Method Detail |
---|
public String generate(com.google.gwt.core.ext.TreeLogger logger, com.google.gwt.core.ext.GeneratorContext context, String typeName) throws com.google.gwt.core.ext.UnableToCompleteException
generate
in class com.google.gwt.core.ext.Generator
com.google.gwt.core.ext.UnableToCompleteException
public String generate(com.google.gwt.core.ext.TreeLogger logger, com.google.gwt.core.ext.GeneratorContext context)
AbstractAsyncGenerator
AbstractAsyncGenerator.generateAsync(TreeLogger, GeneratorContext)
to carry out the actual code
generation.
generate
in class AbstractAsyncGenerator
context
- the generator context to use.
protected static void recordBundleKeys(Map<String,Set<String>> discoveredI18nMap, String locale, String bundlePath)
discoveredI18nMap
- locale
- bundlePath
- public static String getLocaleFromBundlePath(String bundlePath)
bundlePath
- path to the message bundleprotected static void generateI18nHelperFilesInto(Map<String,Set<String>> discoveredI18nMap, Map<String,String> translationKeyFieldMap, File destDir)
discoveredI18nMap
- a map of keys found in all scanned bundlestranslationKeyFieldMap
- a map of translation keys found in TranslationKey
annotated fieldsdestDir
- where to write the *.json filescontext
- the generator context
|
Errai 3.0.1-SNAPSHOT | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |