Class TranslationGroup
java.lang.Object
io.goobi.viewer.model.translations.admin.TranslationGroup
Groups a set of translatable message keys of the same category for display and editing in the admin backend.
Each group has a TranslationGroup.TranslationGroupType that determines how its entries are loaded (e.g. from Solr
field names, Solr field values, or message property files), along with a name, description, and a list of
TranslationGroupItem patterns that define which keys belong to the group.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumDefines the source from which message keys and their translations are loaded for aTranslationGroup. -
Method Summary
Modifier and TypeMethodDescriptionstatic TranslationGroupcreate(int id, TranslationGroup.TranslationGroupType type, String name, String description, int numItems) Factory method.booleanbooleanintReturns the number of entries which finished (non-zzz) translations for all languages.doubleintgetId()getItems()getName()Returns the number of entries which finished (non-zzz) translations for at least one but less than all languages.doubleintgetType()doubleinthashCode()booleanbooleanbooleanstatic booleanCheck whether the application has write access to all local messages files as well as the containing folder if any languages have no local message file.booleanbooleanvoidSets the nextMessageEntryelement in the list active.voidSets the previousMessageEntryelement in the list active.voidSets selectedEntry to null without prior saving.voidResets the counts for fully translated and untranslated entries to update the translation process.voidPersists the edited values ofselectedEntryto all language messages.properties files.voidsetFilterString(String filterString) voidsetLoadError(boolean loadError) voidsetNewEntryMode(boolean newEntryMode) voidsetSelectedEntry(MessageEntry selectedEntry) voidsetSelectedEntryIndex(int selectedEntryIndex)
-
Method Details
-
create
public static TranslationGroup create(int id, TranslationGroup.TranslationGroupType type, String name, String description, int numItems) Factory method.- Parameters:
id- unique ID numbertype- the type of this translation groupname- display name of this groupdescription- human-readable description of this groupnumItems- initial capacity for the items list- Returns:
- Created
TranslationGroup
-
hashCode
public int hashCode() -
equals
-
findEntryByMessageKey
- Parameters:
key- Message key to find- Returns:
- true if message entry was found or added; false if no matching group item could be found
-
getId
public int getId() -
getType
-
getName
-
getDescription
-
getItems
-
getEntryCount
public int getEntryCount()- Returns:
- Number of unique message keys across all groups
-
getUntranslatedEntryCount
- Returns:
- Number of entries with no translations at all
-
getPartiallyTranslatedEntryCount
Returns the number of entries which finished (non-zzz) translations for at least one but less than all languages.- Returns:
- Number of partially translated entries
-
getFullyTranslatedEntryCount
Returns the number of entries which finished (non-zzz) translations for all languages.- Returns:
- Number of fully translated entries
-
getUntranslatedEntryCountPercentage
public double getUntranslatedEntryCountPercentage()- Returns:
- Percentage represented by untranslated entries
-
getPartiallyTranslatedEntryCountPercentage
public double getPartiallyTranslatedEntryCountPercentage()- Returns:
- Percentage represented by partially translated entries
-
getFullyTranslatedEntryCountPercentage
public double getFullyTranslatedEntryCountPercentage()- Returns:
- Percentage represented by fully translated entries
-
isFullyTranslated
public boolean isFullyTranslated()- Returns:
- true if all entries are fully translated; false otherwise
-
isAllFilteredEntriesFullyTranslated
public boolean isAllFilteredEntriesFullyTranslated()- Returns:
- true if all entries in the filtered list are fully translated; false otherwise
-
isHasEntries
public boolean isHasEntries()- Returns:
- true if the allEntries list for this group is not empty; false otherwise
-
getFilteredEntries
- Returns:
- List
-
getAllEntries
- Returns:
- Unique message keys across all groups
-
getSelectedEntry
-
setSelectedEntry
-
resetSelectedEntry
public void resetSelectedEntry()Sets selectedEntry to null without prior saving. -
getSelectedEntryIndex
public int getSelectedEntryIndex() -
setSelectedEntryIndex
public void setSelectedEntryIndex(int selectedEntryIndex) -
getFilterString
-
setFilterString
-
isLoadError
public boolean isLoadError() -
setLoadError
public void setLoadError(boolean loadError) -
isNewEntryMode
public boolean isNewEntryMode() -
setNewEntryMode
public void setNewEntryMode(boolean newEntryMode) -
prevEntry
public void prevEntry()Sets the previousMessageEntryelement in the list active. -
nextEntry
public void nextEntry()Sets the nextMessageEntryelement in the list active. -
saveSelectedEntry
public void saveSelectedEntry()Persists the edited values ofselectedEntryto all language messages.properties files. -
isHasFileAccess
public static boolean isHasFileAccess()Check whether the application has write access to all local messages files as well as the containing folder if any languages have no local message file. The tested languages are taken fromViewerResourceBundle.getAllLocales()- Returns:
- true if all required access rights to edit messages are present. false otherwise
-
resetStatusCount
public void resetStatusCount()Resets the counts for fully translated and untranslated entries to update the translation process.
-