public class L10nBundle
extends de.ipcon.db.core.L10nBundleBase
L10nBundleBase
.
An L10n bundle acts as a container for L10nResource
objects, which in turn
hold localized L10nEntry
key-value pairs for various locales. This class provides
methods for managing these localization resources, including creation, update,
and deletion, as well as import/export functionalities for translator versions.
ATT_Locale1, ATT_Locale2, ATT_Locale3, ATT_PathPos, ATT_Preload, ATT_Resources, ENT_L10nBundle
ATT_Beschreibung, ATT_KinderRefs, ATT_L10nBeschreibung, ATT_L10nName, ATT_Name, ENT_Benannt
ATT_AlsAntwortAnBeiAuftraegen, ATT_AlsEmpfaengerBCCBeiAuftraegen, ATT_AlsEmpfaengerBeiAuftraegen, ATT_AlsEmpfaengerCCBeiAuftraegen, ATT_AlsKontextBOBeiAuftraegen, ATT_WirdAlsAntwortAnVerwendetBeiAlarmen, ATT_WirdBenachrichtigtBCCBeiAlarm, ATT_WirdBenachrichtigtBeiAlarm, ATT_WirdBenachrichtigtCCBeiAlarm, ENT_CoreBO
BLOB_KEY, CANCEL_RECALC_CALLED, D_0, D_1, D_10, D_100, D_1000, D_10000, D_5, D_MINUS_1, D_MINUS_ONE, D_ONE, D_ZERO, doExWriteLRMFunction, EMPTY_ARRAY, F_0, F_1, L_0, L10N_KEY_BO_INSTANTIATION, L10N_KEY_BO_WITH_PROTECTED_CONSTRUCTOR, NULL_AGGREGATE, NULL_ITERATOR
ATT_Badge, ATT_Badge2, ATT_Badge3, ATT_Badge4, ATT_BLOBCreatedBy, ATT_BLOBCreatedOn, ATT_BLOBDeletedBy, ATT_BLOBDeletedOn, ATT_BLOBLastModifiedBy, ATT_BLOBLastModifiedOn, ATT_Bot, ATT_Crea, ATT_CreatedBy, ATT_CreatedModifiedText, ATT_Id, ATT_InvolvedInProcs, ATT_LastModifiedBy, ATT_Ldel, ATT_Lmod, ATT_Procs, EMPTY_ARRAY, ENT_BO
Constructor and Description |
---|
L10nBundle()
Constructs a new, empty
L10nBundle instance. |
Modifier and Type | Method and Description |
---|---|
boolean |
action_exportTranslatorVersions(BasicClientContextI ctx)
Shows a dialog window that allows the user to select the source and target locales for
which this L10n bundle should be exported.
|
boolean |
action_exportTranslatorVersions(BasicClientContextI ctx,
de.ipcon.db.core.L10nBundleExportMode mode)
Initiates the export process for translator versions of this L10n bundle.
|
boolean |
action_exportTranslatorVersions(BasicClientContextI ctx,
L10nLocale fromLocale) |
boolean |
action_exportTranslatorVersions(BasicClientContextI ctx,
L10nLocale fromLocale,
java.lang.Object[] toLocales) |
boolean |
action_exportTranslatorVersions(BasicClientContextI ctx,
L10nLocale fromLocale,
java.lang.Object[] toLocales,
de.ipcon.db.core.L10nBundleExportMode mode) |
boolean |
action_importTranslatorVersions(BasicClientContextI ctx)
Initiates the import process for translator versions, typically when a file is received back from a translator.
|
boolean |
action_syncWithSchema(BasicClientContextI ctx) |
void |
addResource(L10nResource r) |
void |
afterVerifyOnServer(java.lang.Long nodeNumber,
Benutzer user,
Transaction tx) |
static L10nBundle |
assureAndIncludeBundle(Transaction tx,
java.lang.String name)
Returns the
L10nBundle with the given name from the specified Transaction context. |
static L10nBundle |
assureAndIncludeBundle(Transaction tx,
java.lang.String name,
java.lang.String description) |
static void |
assureBOPackageBundles(Transaction tx,
L10nLocale schemaLocale,
java.lang.String boPackage) |
void |
assureResource(java.lang.String key,
java.lang.String val,
L10nLocale locale)
Checks if an
L10nResource for the specified key exists within this bundle. |
void |
assureResource(java.lang.String key,
java.lang.String val,
L10nLocale locale,
java.lang.String origin) |
static void |
assureSchemaBundles(Transaction tx,
L10nLocale schemaLocale)
Creates default
L10nResource entries for all Ordner (folders), Entities and Attributes
defined in the SchemaI of the given Transaction . |
static void |
assureSchemaBundles(Transaction tx,
L10nLocale schemaLocale,
java.lang.String modulePackage) |
void |
bumpResourceVersions() |
static L10nBundle |
createOrUpdateFromTranslatorVersion(java.io.InputStream is,
Transaction tx)
Reads localization data from the given
InputStream , originating from a translator version file. |
static L10nBundle |
createOrUpdateFromTranslatorVersion(java.io.InputStream is,
Transaction tx,
boolean allowClearing) |
static L10nBundle |
createOrUpdateFromTranslatorVersion(java.io.InputStream is,
Transaction tx,
boolean allowClearing,
java.lang.String filename) |
boolean |
exportAllTranslatorVersions(BasicClientContextI ctx,
L10nLocale fromLocale,
java.lang.Object[] toLocales)
A wrapper method for exporting the L10n bundle to multiple translator versions.
|
boolean |
exportAllTranslatorVersions(BasicClientContextI ctx,
L10nLocale fromLocale,
java.lang.Object[] toLocales,
java.util.concurrent.CompletableFuture prefetchingFuture) |
boolean |
exportAllTranslatorVersions(BasicClientContextI ctx,
L10nLocale fromLocale,
java.lang.Object[] toLocales,
java.util.concurrent.CompletableFuture prefetchingFuture,
de.ipcon.db.core.L10nBundleExportMode mode) |
void |
exportTranslatorVersion(BasicClientContextI ctx,
java.io.File outfile,
java.lang.String filename,
L10nLocale sourceLocale,
L10nLocale targetLocale,
java.util.Collection prefetchedResources,
de.ipcon.db.core.L10nBundleExportMode mode,
boolean wrapLongLines)
Exports this L10n bundle for a single translator version to a specified file location and filename.
|
static L10nPackProviderI |
findNextL10nPackProvider(BOLoaderI bol)
Returns the first
L10nPackProviderI instance found along the current
Business Object Loader (BOLoader) chain. |
L10nLocale |
getLocale1() |
L10nLocale |
getLocale2() |
L10nLocale |
getLocale3() |
static L10nBundle |
getOrCreateByName(BOLoaderI bol,
java.lang.String name)
Finds an existing L10n bundle by its name, or creates a new one if no matching bundle is found.
|
static L10nBundle |
getOrCreateByName(BOLoaderI bol,
java.lang.String name,
boolean preload) |
static L10nBundle |
getOrCreateByName(BOLoaderI bol,
java.lang.String name,
boolean preload,
java.lang.Integer pathpos) |
L10nPack |
getPack(L10nLocale l) |
L10nPack |
getPack(java.util.Locale locale) |
L10nResource |
getResource(java.lang.String s) |
static void |
initEnvironment(Transaction tx,
UnresolvedReferencesResolver urr,
boolean authoritative)
Initializes the L10n environment by loading localization resources from predefined
paths within the application's resources and creating corresponding
L10nBundle s. |
void |
initVirtualLocales()
Initializes the locale-related virtual attributes (vattrs) for this
L10nBundle . |
boolean |
isBaseCoreBundle()
Checks if this L10nBundle is the base core bundle.
|
boolean |
isBOBundle()
Checks if this L10nBundle is considered a Business Object (BO) bundle.
|
boolean |
isCoreBOBundle()
Checks if this L10nBundle is the designated core Business Object (BO) bundle.
|
boolean |
isCoreBOEntityBundle()
Checks if this L10nBundle is a designated core Business Object (BO) bundle for a specific entity.
|
boolean |
isCoreBundle()
Checks if this L10nBundle is a core bundle.
|
static boolean |
isCorePackageName(java.lang.String name)
Checks if the passed package name represents a core bundle.
|
boolean |
isModuleBOBundle()
Checks if this L10nBundle itself is a module-specific Business Object (BO) bundle.
|
boolean |
isModuleBOEntityBundle()
Checks if this L10nBundle itself is a module-specific Business Object (BO) bundle for an entity.
|
static boolean |
isModuleBOEntityName(java.lang.String name)
Checks if the passed package name represents a module Business Object (BO) bundle for a specific entity.
|
static boolean |
isModuleBOPackageName(java.lang.String name)
Checks if the passed package name represents a module Business Object (BO) bundle.
|
boolean |
isModuleBundle()
Checks if this L10nBundle itself is a module-specific bundle.
|
static boolean |
isModulePackageName(java.lang.String name)
Checks if the passed package name represents a module bundle.
|
boolean |
isProjectBOBundle()
Checks if this L10nBundle is a project-specific Business Object (BO) bundle,
specifically also identifying bundles related to BO subpackages within the project.
|
boolean |
isProjectBundle()
Checks if this L10nBundle itself is a project-specific bundle.
|
static boolean |
isProjectPackageName(SchemaI schema,
java.lang.String name)
Checks if the passed package name represents a project bundle.
|
java.lang.String |
readCompleteLine(java.io.BufferedReader r)
Reads the next complete "line" from the given
BufferedReader ,
intelligently handling continuation lines and ignoring empty lines and comments. |
void |
removeResource(L10nResource r) |
java.lang.Object[] |
requestFromAndToLocales(BasicClientContextI ctx)
Prompts the user to select source and target locales for localization export.
|
void |
setLocale1(L10nLocale l) |
void |
setLocale2(L10nLocale l) |
void |
setLocale3(L10nLocale l) |
void |
setName(java.lang.String s) |
L10nBundle |
unlazyForGraphCaching() |
void |
updateResourceCache(L10nResource r,
java.lang.String oldKey,
java.lang.String newKey) |
void |
verifyOnClient(BasicClientContextI ctx) |
copyFrom, copyFrom, equalPayload, getPathPos, getPathPosNN, getPathPosNN, getPreload, getPreloadNN, getPreloadNN, getResources, getResourcesIterator, istPreload, needLocale1, needLocale2, needLocale3, needPathPos, needPopulatedResources, needPreload, pgetResourcesLazy, readExternal, setBOLoader, setPathPos, setPreload, setResources, slim, slim, writeExternal
compareTo, createTID, createTID, getL10nBeschreibung, getL10nName, getPairStorage, inputAsBenanntRelation, inputAsBenanntRelation, inputAsBenanntRelation, inputAsBenanntRelation, inputAsMultiBenanntRelation, inputAsMultiBenanntRelation, inputAsMultiBenanntRelation, inputAsMultiRelation, inputAsMultiRelation, inputAsMultiRelation, inputAsRelation, inputAsRelation, inputAsRelation, inputAsRelation, outputAsBenanntRelation, outputAsBenanntRelation, outputAsMultiBenanntRelation, outputAsMultiBenanntRelation, outputAsMultiRelation, outputAsMultiRelation, outputAsRelation, outputAsRelation, outputAsRelation, outputBOTName, outputIntoElement, outputIntoElement, storePreparedRelationQueryResult
addKinderRef, getBeschreibung, getBeschreibungNE, getBeschreibungNN, getBeschreibungNN, getKinderRefs, getKinderRefsIterator, getL10nBeschreibungNE, getL10nBeschreibungNN, getL10nBeschreibungNN, getL10nNameNE, getL10nNameNN, getL10nNameNN, getName, getNameNE, getNameNN, getNameNN, needBeschreibung, needL10nBeschreibung, needL10nName, needName, needPopulatedKinderRefs, pgetKinderRefsLazy, removeKinderRef, setBeschreibung, setKinderRefs
addAlsAntwortAnBeiAuftrag, addAlsEmpfaengerBCCBeiAuftrag, addAlsEmpfaengerBeiAuftrag, addAlsEmpfaengerCCBeiAuftrag, addAlsKontextBOBeiAuftrag, addWirdAlsAntwortAnVerwendetBeiAlarm, addWirdBenachrichtigtBCCBeiAlarm, addWirdBenachrichtigtBeiAlarm, addWirdBenachrichtigtCCBeiAlarm, getAlsAntwortAnBeiAuftraegen, getAlsAntwortAnBeiAuftraegenIterator, getAlsEmpfaengerBCCBeiAuftraegen, getAlsEmpfaengerBCCBeiAuftraegenIterator, getAlsEmpfaengerBeiAuftraegen, getAlsEmpfaengerBeiAuftraegenIterator, getAlsEmpfaengerCCBeiAuftraegen, getAlsEmpfaengerCCBeiAuftraegenIterator, getAlsKontextBOBeiAuftraegen, getAlsKontextBOBeiAuftraegenIterator, getWirdAlsAntwortAnVerwendetBeiAlarmen, getWirdAlsAntwortAnVerwendetBeiAlarmenIterator, getWirdBenachrichtigtBCCBeiAlarm, getWirdBenachrichtigtBCCBeiAlarmIterator, getWirdBenachrichtigtBeiAlarm, getWirdBenachrichtigtBeiAlarmIterator, getWirdBenachrichtigtCCBeiAlarm, getWirdBenachrichtigtCCBeiAlarmIterator, needPopulatedAlsAntwortAnBeiAuftraegen, needPopulatedAlsEmpfaengerBCCBeiAuftraegen, needPopulatedAlsEmpfaengerBeiAuftraegen, needPopulatedAlsEmpfaengerCCBeiAuftraegen, needPopulatedAlsKontextBOBeiAuftraegen, needPopulatedWirdAlsAntwortAnVerwendetBeiAlarmen, needPopulatedWirdBenachrichtigtBCCBeiAlarm, needPopulatedWirdBenachrichtigtBeiAlarm, needPopulatedWirdBenachrichtigtCCBeiAlarm, pgetAlsAntwortAnBeiAuftraegenLazy, pgetAlsEmpfaengerBCCBeiAuftraegenLazy, pgetAlsEmpfaengerBeiAuftraegenLazy, pgetAlsEmpfaengerCCBeiAuftraegenLazy, pgetAlsKontextBOBeiAuftraegenLazy, pgetWirdAlsAntwortAnVerwendetBeiAlarmenLazy, pgetWirdBenachrichtigtBCCBeiAlarmLazy, pgetWirdBenachrichtigtBeiAlarmLazy, pgetWirdBenachrichtigtCCBeiAlarmLazy, removeAlsAntwortAnBeiAuftrag, removeAlsEmpfaengerBCCBeiAuftrag, removeAlsEmpfaengerBeiAuftrag, removeAlsEmpfaengerCCBeiAuftrag, removeAlsKontextBOBeiAuftrag, removeWirdAlsAntwortAnVerwendetBeiAlarm, removeWirdBenachrichtigtBCCBeiAlarm, removeWirdBenachrichtigtBeiAlarm, removeWirdBenachrichtigtCCBeiAlarm, setAlsAntwortAnBeiAuftraegen, setAlsEmpfaengerBCCBeiAuftraegen, setAlsEmpfaengerBeiAuftraegen, setAlsEmpfaengerCCBeiAuftraegen, setAlsKontextBOBeiAuftraegen, setWirdAlsAntwortAnVerwendetBeiAlarmen, setWirdBenachrichtigtBCCBeiAlarm, setWirdBenachrichtigtBeiAlarm, setWirdBenachrichtigtCCBeiAlarm
_set, $, $, $, $$, $$bo, $$o, $$r, $$ri, $$ri, acquireTxWriteLock, add, afterSaveOnClient, afterSaveOnServer, afterVerifyOnClient, aggregate, aggregate, aggregate, aggregate, badge, badge, beforeVerifyOnClient, beforeVerifyOnServer, bumpVersion, cacheLocally, cacheLocally, cacheLocallyAndThrowUnwrappedCause, cacheLocallyAndThrowUnwrappedCause, cacheLocallyAndThrowUnwrappedUncheckedCause, cacheLocallyAndThrowUnwrappedUncheckedCause, cancelCheckConstraints, cancelRecalc, cancelRecalcViaLoadingTransaction, clone, commitTransaction, computeTransientPropertyIfAbsent, conciseDesc, conciseDesc, conciseDesc, conciseDesc, conciseDesc, conciseDesc, conciseDesc, conciseDesc, consumeAndAssureTransientPropertyExists, copyBLOBFrom, createCopy, createCopy, deepClone, deepClone, delete, describe, describe, describe, describe, describe, describe, describe, describe, describe, describe, describeId, describeId, describeId, describeId, describeId, describeId, describeId, describeId, describeNE, describeNE, describeNE, describeNE, describeNE, destub, equalPayload, equalPayload, equalPayload, equalPayload, equals, equalsBO, equalsBO, equalsRegardingAttrs, exportBLOB, exReadString, exWriteString, forgetTransientBLOBHandle, frap, getAsBOInIssueReports, getAsBOInIssueReportsIterator, getAsString, getBackendBOLoaderWithPersistenceHandler, getBadge, getBadge, getBadge2, getBadge3, getBadge4, getBLOB, getBLOB, getBLOB, getBLOB, getBLOB, getBLOBAsDataInput, getBLOBAsEncodedString, getBLOBAsEncodedString, getBLOBAsInputStream, getBLOBAsUTF8EncodedString, getBLOBCreatedBy, getBLOBCreatedOn, getBLOBDeletedBy, getBLOBDeletedOn, getBLOBInfo, getBLOBLastModifiedBy, getBLOBLastModifiedOn, getBOLoader, getBot, getBOVersion, getBytes, getCache, getCache, getCache, getCache, getCache, getCacheNT, getCacheNT, getCacheNT, getCacheNT, getCacheNT, getCacheProvider, getCacheProvider, getClazz, getCreatedBy, getCreatedModifiedText, getDefaultScriptImportsList, getDefaultScriptImportsList, getDefaultScriptImportsList, getDescribingBOWrapper, getDescribingBOWrapper, getEventProvider, getEventProvider, getId, getInvolvedInProcs, getInvolvedInProcsIterator, getLastModifiedBy, getLazyData, getLoadingTransaction, getNullIterator, getOrCreate, getOrCreate, getOrCreate, getOrCreate, getOrCreate, getOrCreate, getOrCreate, getPermissionHandler, getProcs, getProcsIterator, getRootLoaderSchema, getSchema, getSizeFast, getTransaction, getTransientProperty, getTransientProperty, getWrappedTransientProperty, hasActiveTransaction, hasBLOB, hasBLOBOnServerSide, hasBOAssignedTempId, hashCode, hasRelationObjects, hasRelationObjects, hasSessionAssignedTempId, hasTempId, hasTempIdForNewBOs, hasTransientProperty, hasTransientPropertyUnfiltered, includeAllowed, includeInTransaction, invalidateBLOBCache, isBOAssignedTempId, isCompoundChangeInProgress, isCurrentTransactionUnderAdminControl, isIgnoreModificationConstraints, isMandatory, isNew, isReadOnly, isServerSideAndLoadedReadOnly, isSessionAssignedTempId, isStub, isTempId, isTempIdForNewInstance, isTemporary, isVisible, isWriteable, markCompoundChangeInProgress, markDelete, markUndelete, needLoadingTransaction, needsReload, needTransactionInclusion, newInstance, newInstance, newInstance, newInstance, newInstance, newInstance, nextTempId, notifyMessageBus, notifyMessageBus, notifyMessageBus, notifyMessageBus, notifyMessageBus, notifyMessageBus, notifyMessageBusOfAdd, notifyMessageBusOfRemove, nullSafeCompareTo, nullSafeCompareTo, nullSafeContainsBO, nullSafeContainsBO, nullSafeEquals, nullSafeEqualsBO, nullSafeEqualsBO, ofStub, propertyMissing, propertyMissing, releaseCompoundChangeInProgress, releaseTxWriteLock, remove, removeBLOB, requireNonEmptyRelation, requireNonNullAttribute, requireNonNullAttributes, requireNonNullAttributes, requireNonNullAttributes, requireNonNullAttributes, requireNonNullAttributes, requireNonNullAttributes, requireNonNullAttributes, setAsString, setBadge, setBadge, setBadge2, setBadge3, setBadge4, setBOLoaderNoCascade, setBOLoaderNoCascade, setBot, setId, setId, setIgnoreModificationConstraints, setLazyData, setTempId, setTransientProperty, setTransientProperty, setTransientProperty, setTransientProperty, setTransientProperty, setTransientProperty, slim, slim, storeBLOB, storeBLOB, storeBLOB, storeBLOB, storeBLOB, stub, toMap, toMap, toMap, toMap, toMap, toMap, toMap, toMap, toMap, toMap, toMap, toMap, toRelationMapRO, toRelationMapRO, toRelationMapRO, toRelationMapRO, toRelationMapRO, toRelationMapRO, toRelationMapRO, toRelationMapRO, toString, undelete, verifyOnServer, wrapIfGroovy
getCrea, getLdel, getLmod, isDeleted, isLdel, setCrea, setLdel, setLdel, setLmod
getInstanceSpecificLocale, getInstanceSpecificPaths, l10n, l10n, l10n, l10n, l10n, l10n, l10n
bumpVersion, cancelCheckConstraints, consumeAndAssureTransientPropertyExists, contains, delete, equalsBO, equalsBO, filterDeleted, filterDeleted, filterDeleted, filterDeleted, filterDeletedAndReturnMap, filterDeletedAndReturnMap, getAttribute, getAttribute, getBLOB, getBLOB, getBOVersion, getClazz, getCrea, getEntity, getEntity, getRootLoaderSchema, getSchema, getTransientProperty, hasBLOB, hasTransientProperty, hasTransientPropertyUnfiltered, isDeleted, isMandatory, isNew, isReadOnly, isSubEntityOf, isSubEntityOf, isTemporary, isVisible, setTransientProperty, toRelationMapRO
collectIds, collectIds, getCommaSeparatedIdList, getId, toMap, toMap
collectDescribe, collectDescribe, conciseDesc, conciseDesc, conciseDesc, conciseDesc, conciseDesc, conciseDesc, conciseDesc, conciseDesc, describe, describe, describe, describe, describeAndConciseDesc, describeAndConciseDesc, describeAndConciseDesc, describeAndConciseDesc, describeAndConciseDesc, describeNE, describeNE, join, join, join, notEmptyDescription
public L10nBundle()
L10nBundle
instance.
This constructor is typically used by the BO loading mechanism or when a new
bundle is instantiated programmatically before its properties are set.public static L10nPackProviderI findNextL10nPackProvider(BOLoaderI bol)
L10nPackProviderI
instance found along the current
Business Object Loader (BOLoader) chain.
This method is used to discover localization pack providers dynamically, which are responsible for supplying localized content. It traverses the hierarchy of BOLoaders to find the most appropriate provider.
FIXME This method should ideally reside in de/ipcon/tools/L10n
but cannot be placed there currently due to build-time dependencies
(specifically, BOLoaderI
is not available in that package's build context).
bol
- A BOLoaderI
to start the search from.L10nPackProviderI
instance if found, or null
if no
pack provider is available in the loader chain.public static L10nBundle getOrCreateByName(BOLoaderI bol, java.lang.String name)
bol
- The BOLoaderI
to use for looking up or creating the bundle.name
- The unique name to use for lookup or for the creation of a new bundle.preload
- If a new bundle needs to be created, this parameter can be used to preset
the Preload
attribute of the new bundle. Defaults to false
.pathpos
- If a new bundle needs to be created, this parameter can be used to preset
the PathPos
attribute (path position) of the new bundle.
Defaults to null
.L10nBundle
matching the given name.public static L10nBundle getOrCreateByName(BOLoaderI bol, java.lang.String name, boolean preload)
public static L10nBundle getOrCreateByName(BOLoaderI bol, java.lang.String name, boolean preload, java.lang.Integer pathpos)
public static void initEnvironment(Transaction tx, UnresolvedReferencesResolver urr, boolean authoritative)
L10nBundle
s.
This method is called from the DBMan
/BOEnvironmentBuilder
during system startup.
It ensures that core and project-specific localization bundles are loaded and available.
The process is skipped if the server is not authoritative or the startup is in its non-destructive phase (e.g. during an update-script execution phase).
tx
- The Transaction
to use for database operations.urr
- The UnresolvedReferencesResolver
to handle any unresolved references during loading.authoritative
- If true
, the environment is initialized for an authoritative server,
allowing import of custom L10nBundles.
If false
, custom bundle import is skipped.public static L10nBundle createOrUpdateFromTranslatorVersion(java.io.InputStream is, Transaction tx)
InputStream
, originating from a translator version file.
Based on the data, it either loads and updates an existing L10nBundle
or creates a new one.
This static method orchestrates the import, including header parsing and resource loading. It's typically the entry point for importing translated files.
is
- The InputStream
containing the translator version data.tx
- The Transaction
in which to create or update the L10nBundle
and its resources.allowClearing
- If true
(default), existing entries with non-null non-empty values for
the given locale are allowed to be overwritten with a null/empty value;
If false
, the old non-null non-empty value is kept in such cases.filename
- An optional String
representing the name of the file being loaded,
used for logging the origin of an L10nResource in its "Origin" attribute.
Defaults to null
.L10nBundle
that was either found and updated, or newly created.IOException
- If an I/O error occurs during reading or processing.IRuntimeException
- If parsing fails or required data is missing.public static L10nBundle createOrUpdateFromTranslatorVersion(java.io.InputStream is, Transaction tx, boolean allowClearing)
public static L10nBundle createOrUpdateFromTranslatorVersion(java.io.InputStream is, Transaction tx, boolean allowClearing, java.lang.String filename)
public void verifyOnClient(BasicClientContextI ctx)
verifyOnClient
in interface SaveVetoI
verifyOnClient
in class BO
public void afterVerifyOnServer(java.lang.Long nodeNumber, Benutzer user, Transaction tx)
afterVerifyOnServer
in interface SaveAwareI
afterVerifyOnServer
in class BO
public void setName(java.lang.String s)
setName
in class de.ipcon.db.core.BenanntBase
public void initVirtualLocales()
L10nBundle
.
This method systematically sets up three primary locales (Locale1, Locale2, and Locale3)
for the bundle, following a specific preference and fallback logic:
Locale#GERMAN
).Locale#ENGLISH
), then French (Locale#FRENCH
), followed by
all other available locales sorted by their natural string representation.
The "other" locales used for Locale2 and Locale3 selection are initially filtered to
exclude both the system's default locale and German, ensuring distinct choices.
They are then sorted using an instance of L10nLocaleComparator
, which applies the specific
preference order (English, then French, then natural string representation for others).
public L10nLocale getLocale1()
getLocale1
in class de.ipcon.db.core.L10nBundleBase
public L10nLocale getLocale2()
getLocale2
in class de.ipcon.db.core.L10nBundleBase
public L10nLocale getLocale3()
getLocale3
in class de.ipcon.db.core.L10nBundleBase
public void setLocale1(L10nLocale l)
setLocale1
in class de.ipcon.db.core.L10nBundleBase
public void setLocale2(L10nLocale l)
setLocale2
in class de.ipcon.db.core.L10nBundleBase
public void setLocale3(L10nLocale l)
setLocale3
in class de.ipcon.db.core.L10nBundleBase
public void bumpResourceVersions()
public void addResource(L10nResource r)
addResource
in class de.ipcon.db.core.L10nBundleBase
public void removeResource(L10nResource r)
removeResource
in class de.ipcon.db.core.L10nBundleBase
public void updateResourceCache(L10nResource r, java.lang.String oldKey, java.lang.String newKey)
public L10nResource getResource(java.lang.String s)
public L10nBundle unlazyForGraphCaching()
public L10nPack getPack(java.util.Locale locale)
public L10nPack getPack(L10nLocale l)
public static void assureSchemaBundles(Transaction tx, L10nLocale schemaLocale)
L10nResource
entries for all Ordner (folders), Entities and Attributes
defined in the SchemaI
of the given Transaction
. This method also identifies
and removes any obsolete L10nResource
objects that no longer correspond to schema elements.tx
- The Transaction
within which to create or remove L10nResources.schemaLocale
- The L10nLocale
for which schema-related bundles should be assured.modulePackage
- The module package name for which schema-related bundles should be assured. Optional.
If null, the pack of the entity is used.public static void assureSchemaBundles(Transaction tx, L10nLocale schemaLocale, java.lang.String modulePackage)
public static void assureBOPackageBundles(Transaction tx, L10nLocale schemaLocale, java.lang.String boPackage)
public boolean isBOBundle()
true
if this bundle is a core BO bundle, a module BO bundle, or a project BO bundle, false
otherwise.isCoreBOBundle()
,
isModuleBOBundle()
,
isProjectBOBundle()
public boolean isBaseCoreBundle()
MyTISMConstantsI.PACKAGE_NAME_MYTISM_BASE
constant.true
if this bundle is the base core bundle, false
otherwise.public boolean isCoreBundle()
MyTISMConstantsI.PACKAGE_NAME_MYTISM_CORE
constant.true
if this bundle is a core bundle, false
otherwise.public boolean isCoreBOBundle()
MyTISMConstantsI.PACKAGE_NAME_MYTISM_CORE
constant.true
if this bundle is the core BO bundle, false
otherwise.public boolean isCoreBOEntityBundle()
MyTISMConstantsI.PACKAGE_PREFIX_MYTISM_CORE
constant.true
if this bundle is a core BO bundle for an entity, false
otherwise.public static final boolean isCorePackageName(java.lang.String name)
A package name is identified as a core bundle name if it meets the following criteria:
null
.MyTISMConstantsI#PACKAGE_NAME_MYTISM_BASE
.name
- The String
package name to check.true
if the passed package name represents a core bundle,
false
otherwise.public static final boolean isModulePackageName(java.lang.String name)
A package name is identified as a module bundle name if it meets the following criteria:
null
.MyTISMConstantsI#PACKAGE_PREFIX_MODULES
.name
- The String
package name to check.true
if the passed package name represents a module bundle,
false
otherwise.public static final boolean isProjectPackageName(SchemaI schema, java.lang.String name)
A package name is considered a project bundle name if it is not null, the project's default package name from the schema is not null, and the package name starts with the project's default package name.
schema
- The SchemaI
instance from which to retrieve the
project's default package name.name
- The String
package name to check.true
if the passed package name represents a project bundle,
false
otherwise.public static final boolean isModuleBOPackageName(java.lang.String name)
A package name is identified as a module BO bundle name if it meets the following criteria:
null
.MyTISMConstantsI#PACKAGE_PREFIX_MODULES
.MyTISMConstantsI#PACKAGE_SUFFIX_BO
(".bo").name
- The String
package name to check.true
if the passed package name represents a module BO bundle,
false
otherwise.public static final boolean isModuleBOEntityName(java.lang.String name)
A package name is identified as a module BO bundle name if it meets the following criteria:
null
.MyTISMConstantsI#PACKAGE_PREFIX_MODULES
.MyTISMConstantsI#PACKAGE_INFIX_BO
(".bo.").packageName
- The String
package name to check.true
if the passed package name represents a module BO entity bundle,
false
otherwise.public boolean isModuleBundle()
isModulePackageName(String)
,
using the current bundle's non-null name.true
if this bundle is a module-specific bundle, false
otherwise.isModulePackageName(String)
public boolean isModuleBOBundle()
isModuleBOPackageName(String)
,
using the current bundle's non-null name.true
if this bundle is a module-specific BO bundle, false
otherwise.isModuleBOPackageName(String)
public boolean isModuleBOEntityBundle()
isModuleBOPackageName(String)
,
using the current bundle's non-null name.true
if this bundle is a module-specific BO bundle, false
otherwise.isModuleBOPackageName(String)
public boolean isProjectBundle()
This method determines if the bundle's name corresponds to a project package.
It delegates the check to isProjectPackageName(SchemaI, String)
,
using the schema obtained from the current bundle's BOLoader and the bundle's non-null name.
true
if this bundle is a project-specific bundle, false
otherwise.isProjectPackageName(SchemaI, String)
public boolean isProjectBOBundle()
A bundle is considered a project BO bundle if its name adheres to specific conventions related to the project's default package and typical Java/NetRexx package structures for subpackages.
public static L10nBundle assureAndIncludeBundle(Transaction tx, java.lang.String name)
L10nBundle
with the given name from the specified Transaction
context.
If a matching instance does not already exist, a new one is created and included in the transaction.tx
- The Transaction
to use for retrieving or creating the bundle.name
- The unique name of the L10nBundle to assure.description
- An optional descriptive text for the bundle if it needs to be created. Defaults to null
.L10nBundle
included in the transaction.public static L10nBundle assureAndIncludeBundle(Transaction tx, java.lang.String name, java.lang.String description)
public void assureResource(java.lang.String key, java.lang.String val, L10nLocale locale)
L10nResource
for the specified key
exists within this bundle.
If it does not exist, a new L10nResource
is created.
If a val
is provided (not null), it also checks if an L10nEntry
exists
for the given locale
. If not, a default L10nEntry
is created with the provided value.key
- The key for which to assure the L10nResource.val
- The value to set for the L10nEntry in the specified locale.
If null
, no L10nEntry will be created or updated for the locale.locale
- The L10nLocale
for which to assure the L10nEntry.origin
- An optional String
indicating the origin of the L10nResource. Defaults to null
.public void assureResource(java.lang.String key, java.lang.String val, L10nLocale locale, java.lang.String origin)
public boolean action_exportTranslatorVersions(BasicClientContextI ctx, de.ipcon.db.core.L10nBundleExportMode mode)
ctx
- The BasicClientContextI
providing the client context.mode
- The L10nBundleExportMode
to use for determining which lines (all,
exclude missing, or only missing translations) will be written to the exported files.true
if the export process was initiated successfully,
false
otherwise (e.g., if the user cancels).public boolean action_exportTranslatorVersions(BasicClientContextI ctx)
exportAllTranslatorVersions(BasicClientContextI, L10nLocale, Object[], CompletableFuture, L10nBundleExportMode)
to perform the actual export process.
Before proceeding, it checks for unsaved changes in the current transaction and aborts the export with a warning to the user if present.
ctx
- The BasicClientContextI
providing the client context for the dialogs.fromLocale
- The source L10nLocale
from which translations are to be exported.
If null
, the user will typically be prompted to select the source locale.toLocales
- An array of Object
s, typically L10nLocale
s, representing
the target locales for which translator versions should be exported.
If null
, the user will typically be prompted to select target locales.mode
- The L10nBundleExportMode
to use, dictating the content of the exported files:
L10nBundleExportMode.ALL
: All lines (keys and values) will be written.
L10nBundleExportMode.EXCLUDE_MISSING_TRANSLATIONS
: No lines will be written
for missing translations. This renders the output files less useful for translators
who need to add missing entries, but may be required to export only
translations in the project BO bundle that are local or do actually deviate (and
are intended to deviate) from any modules' BO bundle standard translation.
L10nBundleExportMode.ONLY_MISSING_TRANSLATIONS
: Only lines for
translations that do not yet exist will be written. This makes the output files
more useful for translators, as they only need to read and add missing entries
without having to skip or review any already existing translation.
true
if the export process was initiated successfully,
false
otherwise (e.g., if the user cancels or if unsaved changes prevent the operation).public boolean action_exportTranslatorVersions(BasicClientContextI ctx, L10nLocale fromLocale)
public boolean action_exportTranslatorVersions(BasicClientContextI ctx, L10nLocale fromLocale, java.lang.Object[] toLocales)
public boolean action_exportTranslatorVersions(BasicClientContextI ctx, L10nLocale fromLocale, java.lang.Object[] toLocales, de.ipcon.db.core.L10nBundleExportMode mode)
public java.lang.Object[] requestFromAndToLocales(BasicClientContextI ctx)
This method presents dialogs to the user, first for selecting the "from" (source) locale, and then for selecting one or more "to" (target) locales from the available locales in the system. It pre-selects the bundle's Locale1 as the default for the source language selection and all available locales as defaults for target language selection, assuming a common use case is to export all translations.
ctx
- The BasicClientContextI
providing the client context for displaying dialogs and querying data.Object
array containing two elements:
L10nLocale
.L10nLocale
s.null
if the user cancels any of the selection dialogs or selects no target locales.public boolean exportAllTranslatorVersions(BasicClientContextI ctx, L10nLocale fromLocale, java.lang.Object[] toLocales)
ctx
- The BasicClientContextI
providing the client context for UI interactions.fromLocale
- The source L10nLocale
from which translations are taken.toLocales
- An array of Object
s, typically L10nLocale
s, representing
the target locales for which translator versions should be exported.prefetchingFuture
- An optional CompletableFuture
that, if provided, can be
used to prefetch resources asynchronously, potentially speeding up the export.
If null, prefetching will be initiated internally.mode
- The L10nBundleExportMode
to use, dictating the content of the exported files:
L10nBundleExportMode.ALL
: All lines (keys and values) will be written.
L10nBundleExportMode.EXCLUDE_MISSING_TRANSLATIONS
: No lines will be written
for missing translations. This renders the output files less useful for translators
who need to add missing entries, but may be required to export only
translations in the project BO bundle that actually deviate (and are intended
to deviate) from any modules' BO bundle standard translation.
L10nBundleExportMode.ONLY_MISSING_TRANSLATIONS
: Only lines for
translations that do not yet exist will be written. This makes the output files
more useful for translators, as they only need to read and add missing entries
without having to skip or review any already existing translation.
true
if the export process for all selected locales was successful, false
otherwise.IRuntimeException
- If an error occurs during the export of any individual translator version,
wrapping the original cause.public boolean exportAllTranslatorVersions(BasicClientContextI ctx, L10nLocale fromLocale, java.lang.Object[] toLocales, java.util.concurrent.CompletableFuture prefetchingFuture)
public boolean exportAllTranslatorVersions(BasicClientContextI ctx, L10nLocale fromLocale, java.lang.Object[] toLocales, java.util.concurrent.CompletableFuture prefetchingFuture, de.ipcon.db.core.L10nBundleExportMode mode)
public void exportTranslatorVersion(BasicClientContextI ctx, java.io.File outfile, java.lang.String filename, L10nLocale sourceLocale, L10nLocale targetLocale, java.util.Collection prefetchedResources, de.ipcon.db.core.L10nBundleExportMode mode, boolean wrapLongLines)
It is preferable to use the higher-level
exportAllTranslatorVersions(BasicClientContextI, L10nLocale, Object[], CompletableFuture, L10nBundleExportMode)
method, which handles save location selection and multi-locale exports more robustly and with prefetching capabilities.
ctx
- The BasicClientContextI
providing the client context.outfile
- The target File
object representing the directory where the file will be saved.filename
- The desired name of the output file (e.g., "mybundle_fr").sourceLocale
- The source L10nLocale
from which translations are taken.targetLocale
- The target L10nLocale
for which this specific translator version is being exported.prefetchedResources
- An optional Collection
of L10nResource
objects that have
already been prefetched. If null
, resources will be loaded synchronously.mode
- The L10nBundleExportMode
to use, dictating the content of the exported files.wrapLongLines
- A flag indicating if lines in the exported text shall be wrapped if longer than 97 chars using
TextBreaker
.java.lang.IllegalArgumentException
- If the bundle's name is empty or null.IRuntimeException
- If an error occurs during file writing.public boolean action_importTranslatorVersions(BasicClientContextI ctx)
This method guides the user through selecting a translator file. It does not parse the filename for bundle or locale information, assuming the file content itself provides this (in the header).
It relies on a specific header format within the file (a line starting with "# destination locale =") to identify the target locale. Deviations from this expected header format will likely lead to errors.
ctx
- The BasicClientContextI
providing the client context for user interaction.true
if the import process was successful, false
otherwise (e.g. if the user cancels).public java.lang.String readCompleteLine(java.io.BufferedReader r) throws java.io.IOException
BufferedReader
,
intelligently handling continuation lines and ignoring empty lines and comments.
A line can be spread across multiple physical lines if the next line starts with whitespace(s).
Comments typically start with '#'.r
- The BufferedReader
from which to read the "line".String
, with continuation markers removed and
comments/empty lines skipped. Returns null
if no more lines are available.IOException
- If an I/O error occurs during reading.public boolean action_syncWithSchema(BasicClientContextI ctx)
Copyright © 2000-2025 OAshi S.à r.l. All Rights Reserved.