Package VASSAL.i18n
Class Localization
- All Implemented Interfaces:
AutoConfigurable,Buildable,Configurable,PropertyNameSource,ValidityChecker,Translatable,Auditable,ImageSearchTarget,SearchTarget
Singleton class for managing the translation of a module into other languages
- Author:
- rodneykinney
-
Nested Class Summary
Nested classes/interfaces inherited from interface VASSAL.build.AutoConfigurable
AutoConfigurable.Util -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Stringprotected List<Translation>protected Stringprotected List<Translation>protected VassalResourceBundleprotected Stringprotected List<Translation>protected Set<TranslatableAttribute>Record attributes as the module is being built for later translationprotected booleanprotected booleanprotected List<Translation>Fields inherited from class VASSAL.build.AbstractConfigurable
changeSupport, config, localizedName, myI18nData, nameFields inherited from class VASSAL.build.AbstractBuildable
buildComponents, validatorFields inherited from interface VASSAL.build.Configurable
NAME_PROPERTY -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddBundle(VassalResourceBundle child) voidCalled whenever a Translation is added to a module or extension.static LocalizationgetTranslation(String description) Return a specified translationString[]Return a list of translations available for editing.booleanIs this component a reqired component within its parent?booleanbooleanbooleanisUnique()Does this component need to be unique within it's parent?voidvoidsaveTranslatableAttribute(Translatable component, String name, String value) Record an attribute that may need to be translated.voidTranslate the module.Translate an individual attribute.Methods inherited from class VASSAL.i18n.Language
addTo, getAllowableConfigureComponents, getAttributeDescriptions, getAttributeNames, getAttributeTypes, getAttributeValueString, getConfigureTypeName, getDescription, getHelpFile, removeFrom, setAttributeMethods inherited from class VASSAL.build.AbstractConfigurable
add, addPropertyChangeListener, getAttributeVisibility, getConfigureComponents, getConfigureName, getConfigurer, getExpressionList, getFormattedStringList, getI18nData, getI18nPrefix, getLocalizedConfigureName, getMenuTextList, getNamedKeyStrokeList, getPropertyList, getTypeName, remove, removePropertyChangeListener, setAllAttributesUntranslatable, setAttributeTranslatable, setConfigureNameMethods inherited from class VASSAL.build.AbstractBuildable
addImageNamesRecursively, build, buildString, getAllDescendantComponentsOf, getAncestor, getBuildables, getBuildComponents, getBuildElement, getComponents, getComponentsOf, getNonFolderAncestor, getPropertyNames, setAncestor, validateMethods inherited from class VASSAL.search.AbstractImageFinder
addLocalImageNames, getAllImageNames, getLocalImageNamesMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface VASSAL.script.expression.Auditable
getComponentName, getComponentTypeNameMethods inherited from interface VASSAL.build.Buildable
build, getBuildElement, isMovable
-
Field Details
-
moduleBundle
-
languageBundle
-
countryBundle
-
moduleTranslations
-
languageTranslations
-
countryTranslations
-
translations
-
masterBundle
-
translatableItems
Record attributes as the module is being built for later translation -
translationInProgress
protected boolean translationInProgress -
translationComplete
protected boolean translationComplete
-
-
Method Details
-
getInstance
-
getTranslationList
Return a list of translations available for editing.- Returns:
- Array of available translations
-
getTranslation
Return a specified translation- Parameters:
description- description- Returns:
- Translation object
-
saveTranslatableAttribute
Record an attribute that may need to be translated.- Parameters:
component- component to be translatedname- Attribute name to be translatedvalue- current value of attribute
-
translate
Translate the module. The module and all extensions have now been built, so all Translations are available and all attributes that need to be translated have been recorded. There may be multiple translations that match this Locale, merge them in order - Country overrides Language overrides default. NB - You cannot create a default translation (Module.properties) using the VASSAL editor, but a default file can be placed into a module or extension manually.- Throws:
IOException- oops
-
translate
Translate an individual attribute.- Parameters:
key- Attribute KeydefaultValue- Default value if no translation available- Returns:
- translation
-
addBundle
-
isTranslationInProgress
public boolean isTranslationInProgress() -
isTranslationComplete
public boolean isTranslationComplete() -
addTranslation
Called whenever a Translation is added to a module or extension. Check if the translation matches our locale. If so, add it to the list of translations to use. There may multiple matching translations at Country, Language and Module level from different extensions.- Parameters:
t- Translation
-
removeTranslation
-
isMandatory
public boolean isMandatory()Description copied from interface:BuildableIs this component a reqired component within its parent?- Specified by:
isMandatoryin interfaceBuildable- Overrides:
isMandatoryin classLanguage- Returns:
- true if component is mandatory
-
isUnique
public boolean isUnique()Description copied from interface:BuildableDoes this component need to be unique within it's parent?
-