Interface ILocalizationManager
-
- All Known Implementing Classes:
LocalizationManager
@StableMinor(version="16.0", sinceVersion="4.2") public interface ILocalizationManager
Manager responsible for string localization and locales- Since:
- 4.0.0
- Version:
- $Revision: 25808 $ $Date: 2023-07-04 15:20:55 -0300 (Tue, 04 Jul 2023) $
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
DO_NOT_RENDER_PARAMETERS
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description void
add(LocaleConfig locale)
Adds the given locale.java.lang.String
addCustomString(SessionConfig sessionConfig, CustomStringConfig customStringConfig, ITransaction transaction)
Add a Custom Stringvoid
clearCache()
Clear the localization cache.void
clearCache(java.lang.String resourcePath)
Clear the localization cache by passing the resource path.void
clearCache(java.lang.String resourcePath, java.util.Locale locale)
Clear the localization cache by passing the resource path and the locale.void
delete(java.lang.String id)
Deletes the locale with the given identifier.void
deleteCustomString(SessionConfig sessionConfig, java.lang.String customStringId, ITransaction transaction)
Delete a specified Custom Stringjava.lang.Iterable<java.lang.String>
getCachedResourcePaths()
Deprecated.Since 8.1.0, this method is no longer available and always returns an empty iterable.CustomStringConfig
getCustomString(SessionConfig sessionConfig, java.lang.String customStringId, ITransaction transaction)
Get the Custom String objectjava.util.Locale
getDefaultLocale()
Returns the portal default locale.java.util.Collection<java.util.Locale>
getLocales()
Returns all locales currently available in the portal.java.util.Collection<LocaleConfig>
getLocales(ITransaction transaction)
Returns the available locales for the portal.java.lang.String
localize(java.lang.String id, java.util.List<IResource> resources)
Localizes the given string id using the given resources and current locale.java.lang.String
localize(java.lang.String id, java.util.List<IResource> resources, java.util.Locale locale)
Localizes the given string id using the given resources and locale.java.lang.String
localize(java.lang.String id, java.util.List<IResource> resources, java.util.Locale locale, WebResource pageWebResource)
Localizes the given string id using the given resources,WebResource
and locale.java.lang.String
localize(java.lang.String id, java.util.List<IResource> resources, PageWebResource pageWebResource)
Localizes the given string id using the given resources,PageWebResource
and current locale.java.lang.String
localize(java.lang.String id, IResource resource)
Localizes the given string id using the given resource and current locale.java.lang.String
localize(java.lang.String id, IResource resource, java.util.Locale locale)
Localizes the given string id using the given resource and locale.java.lang.String
localize(java.lang.String id, IResource resource, java.util.Locale locale, WebResource webResource)
Localizes the given string id using the given resource,WebResource
and locale.java.lang.String
localize(java.lang.String id, IResource resource, PageWebResource pageWebResource)
Localizes the given string id using the given resource,PageWebResource
and current locale.void
update(LocaleConfig locale)
Updates the given locale.void
updateCustomString(SessionConfig sessionConfig, CustomStringConfig customStringConfig, ITransaction transaction)
Update a specified Custom String
-
-
-
Field Detail
-
DO_NOT_RENDER_PARAMETERS
static final java.lang.String DO_NOT_RENDER_PARAMETERS
- See Also:
- Constant Field Values
-
-
Method Detail
-
getLocales
java.util.Collection<LocaleConfig> getLocales(ITransaction transaction) throws PortalException
Returns the available locales for the portal.- Parameters:
transaction
- the transaction for persistence access.- Returns:
- A collection with the available locales.
- Throws:
PortalException
- Since:
- 4.0.10
-
getLocales
java.util.Collection<java.util.Locale> getLocales()
Returns all locales currently available in the portal.- Returns:
- locales available in the portal.
- Since:
- 8.1.0
-
getDefaultLocale
java.util.Locale getDefaultLocale()
Returns the portal default locale. The global portal default locale is assumed to be the default locale of the portal root channel.- Returns:
- the portal default locale.
- Since:
- 8.1.0
-
add
void add(LocaleConfig locale) throws PortalException
Adds the given locale.- Parameters:
locale
- the locale to be added.- Throws:
PortalException
- Since:
- 8.1.0
-
delete
void delete(java.lang.String id) throws PortalException
Deletes the locale with the given identifier.- Parameters:
id
- the locale identifier.- Throws:
PortalException
- Since:
- 8.1.0
-
update
void update(LocaleConfig locale) throws PortalException
Updates the given locale.- Parameters:
locale
- the locale to be updated.- Throws:
PortalException
- Since:
- 8.1.0
-
localize
java.lang.String localize(java.lang.String id, IResource resource) throws PortalException
Localizes the given string id using the given resource and current locale.If no localized value is found for the given id, the id itself is returned.
To take into account localizations from themes, use
If the string id passed in is null, the return value will also be null.localize(String, IResource, PageWebResource)
.- Parameters:
id
- The string id to localizeresource
- The resource to search for localizations- Returns:
- The localized string
Or the received string id when no localization was found. If the passed id is null, null is also returned. - Throws:
PortalException
-
localize
java.lang.String localize(java.lang.String id, IResource resource, PageWebResource pageWebResource) throws PortalException
Localizes the given string id using the given resource,PageWebResource
and current locale.If no localized value is found for the given id, the id itself is returned.
If the string id passed in is null, the return value will also be null.- Parameters:
id
- The string id to localizeresource
- The resource to search for localizationspageWebResource
- ThePageWebResource
used to search for localizations within themes.- Returns:
- The localized string
Or the received string id when no localization was found. If the passed id is null, null is also returned. - Throws:
PortalException
-
localize
java.lang.String localize(java.lang.String id, java.util.List<IResource> resources) throws PortalException
Localizes the given string id using the given resources and current locale.If no localized value is found for the given id, the id itself is returned.
To take into account localizations from themes, use
If the string id passed in is null, the return value will also be null.localize(String, List, PageWebResource)
.- Parameters:
id
- The string id to localizeresources
- The resources to search for localizations- Returns:
- The localized string
Or the received string id when no localization was found. If the passed id is null, null is also returned. - Throws:
PortalException
-
localize
java.lang.String localize(java.lang.String id, java.util.List<IResource> resources, PageWebResource pageWebResource) throws PortalException
Localizes the given string id using the given resources,PageWebResource
and current locale.If no localized value is found for the given id, the id itself is returned.
If the string id passed in is null, the return value will also be null.- Parameters:
id
- The string id to localizeresources
- The resources to search for localizationspageWebResource
- ThePageWebResource
used to search for localizations within themes.- Returns:
- The localized string
Or the received string id when no localization was found. If the passed id is null, null is also returned. - Throws:
PortalException
-
localize
java.lang.String localize(java.lang.String id, IResource resource, java.util.Locale locale) throws PortalException
Localizes the given string id using the given resource and locale.If no localized value is found for the given id, the id itself is returned.
To take into account localizations from themes, use
If the string id passed in is null, the return value will also be null.#localize(String, IResource, Locale, PageWebResource)
.- Parameters:
id
- The string id to localizeresource
- The resource to search for localizationslocale
- The locale to use for localization- Returns:
- The localized string
Or the received string id when no localization was found. If the passed id is null, null is also returned. - Throws:
PortalException
-
localize
java.lang.String localize(java.lang.String id, IResource resource, java.util.Locale locale, WebResource webResource) throws PortalException
Localizes the given string id using the given resource,WebResource
and locale.If no localized value is found for the given id, the id itself is returned.
If the string id passed in is null, the return value will also be null.- Parameters:
id
- The string id to localizeresource
- The resources to search for localizationslocale
- The locale to use for localizationwebResource
- TheWebResource
used to search for localizations within themes.- Returns:
- The localized string
Or the received string id when no localization was found. If the passed id is null, null is also returned. - Throws:
PortalException
-
localize
java.lang.String localize(java.lang.String id, java.util.List<IResource> resources, java.util.Locale locale) throws PortalException
Localizes the given string id using the given resources and locale.If no localized value is found for the given id, the id itself is returned.
To take into account localizations from themes, use
If the string id passed in is null, the return value will also be null.#localize(String, List, Locale, PageWebResource)
.- Parameters:
id
- The string id to localizeresources
- The resources to search for localizationslocale
- The locale to use for localization- Returns:
- The localized string
Or the received string id when no localization was found. If the passed id is null, null is also returned. - Throws:
PortalException
-
localize
java.lang.String localize(java.lang.String id, java.util.List<IResource> resources, java.util.Locale locale, WebResource pageWebResource) throws PortalException
Localizes the given string id using the given resources,WebResource
and locale.If no localized value is found for the given id, the id itself is returned.
If the string id passed in is null, the return value will also be null.- Parameters:
id
- The string id to localizeresources
- The resources to search for localizationslocale
- The locale to use for localizationwebResource
- TheWebResource
used to search for localizations within themes.- Returns:
- The localized string
Or the received string id when no localization was found. If the passed id is null, null is also returned. - Throws:
PortalException
-
clearCache
void clearCache() throws PortalException
Clear the localization cache.- Throws:
PortalException
-
clearCache
void clearCache(java.lang.String resourcePath) throws PortalException
Clear the localization cache by passing the resource path.- Parameters:
resourcePath
-- Throws:
PortalException
-
clearCache
void clearCache(java.lang.String resourcePath, java.util.Locale locale) throws PortalException
Clear the localization cache by passing the resource path and the locale.- Parameters:
resourcePath
-locale
-- Throws:
PortalException
-
getCachedResourcePaths
@Deprecated java.lang.Iterable<java.lang.String> getCachedResourcePaths() throws ManagerException
Deprecated.Since 8.1.0, this method is no longer available and always returns an empty iterable.Get the keys for all cached items- Returns:
- Throws:
ManagerException
-
addCustomString
java.lang.String addCustomString(SessionConfig sessionConfig, CustomStringConfig customStringConfig, ITransaction transaction) throws PortalException
Add a Custom String- Parameters:
sessionConfig
-customStringConfig
-transaction
-- Returns:
- Throws:
PortalException
-
updateCustomString
void updateCustomString(SessionConfig sessionConfig, CustomStringConfig customStringConfig, ITransaction transaction) throws PortalException
Update a specified Custom String- Parameters:
sessionConfig
-customStringConfig
-transaction
-- Throws:
PortalException
-
deleteCustomString
void deleteCustomString(SessionConfig sessionConfig, java.lang.String customStringId, ITransaction transaction) throws PortalException
Delete a specified Custom String- Parameters:
sessionConfig
-customStringId
-transaction
-- Throws:
PortalException
-
getCustomString
CustomStringConfig getCustomString(SessionConfig sessionConfig, java.lang.String customStringId, ITransaction transaction) throws PortalException
Get the Custom String object- Parameters:
sessionConfig
-customStringId
-transaction
-- Returns:
- Throws:
PortalException
-
-