/** * This file is auto generated from JavaDoc. Do not modify it manually. */ import type { List } from "../../types/java/util/List"; import type { Node } from "../../types/javax/jcr/Node"; import type { Map } from "../../types/java/util/Map"; /** * Translation utility interface. * *

* An instance of the Sitevision class implementing this interface can be obtained via * {@link senselogic.sitevision.api.Utils#getTranslationUtil()}. * See {@link senselogic.sitevision.api.Utils} for how to obtain an instance of the Utils interface. *

* @author Magnus Lövgren * @since Sitevision 4.2.1 */ export interface TranslationUtil { /** * Gets a list of all Locales that are set up for translations on the current site. * *

* Note! The returned List is immutable/unmodifiable, * i.e. you must create a copy if you want to modify it (e.g. sort). *

* @return a list of all Locales that are set up for translations on the current site */ getSiteTranslationLocales(): List; /** * Gets the translation mappings for a given page node. * *

* Each entry in the returned map depicts a "translation", i.e. a localized version of the given aPageNode. *

*

* Important note! The returned map is never null, but entry values in the map might be! *

* * *

* Tip! If you are only interested in non-null Nodes/values in the returned map, you can use * {@link senselogic.sitevision.api.node.NodeFilterUtil} to filter them out!
* Below is a conceptual example of how it could be done in server-side JavaScript (e.g. WebApp, RESTApp, Script module). *

    var thePotentiallyTranslatedPageNode = ...,
   *         translationUtil = require('TranslationUtil'),
   *         nodeFilterUtil = require('NodeFilterUtil'),
   *         translationMappings,
   *         skipNullValuesFilter,
   *         filteredTranslationMappings;
   *
   *     translationMappings = translationUtil.getTranslations(thePotentiallyTranslatedPageNode, false);
   *
   *     skipNullValuesFilter = nodeFilterUtil.getNonNullFilter();
   *     filteredTranslationMappings = nodeFilterUtil.getFilteredValueMap(translationMappings, skipNullValuesFilter);
* *

* Please note that determining the "is this page node translated at all?" state from the returned result * depends on the aIncludePageNode value: *

* * @param aPageNode a page node that can be translated * @param aIncludePageNode whether or not to include aPageNode in the result * @return a Map of translation mappings * @since Sitevision 4.3.1 */ getTranslations(aPageNode: Node, aIncludePageNode: boolean): Map; /** * Gets the page node a given node is potentially translated from (the translation source). * @param aPageNode the page node that is translated * @return the page node aPageNode was translated from, or null if the page node isn't translated from another page or if current user doesn't have {@link senselogic.sitevision.api.security.PermissionUtil.Permission#READ} permissions on the from node. * @since Sitevision 4.3.1 */ getTranslatedFrom(aPageNode: Node): Node; /** * Sets the translated from node to the page node provided as translation node. * *

* Permission note! Current user must match have * {@link senselogic.sitevision.api.security.PermissionUtil.Permission#MANAGE_TRANSLATIONS} and * {@link senselogic.sitevision.api.security.PermissionUtil.Permission#WRITE} * on @aTranslationPageNode. *

* @param aOriginalPageNode the original page node to be configured as translated from on aTranslationPageNode. It will be configured as original in aTranslationPageNode as well if aOriginalPageNode doesn't have any original configured. * @param aTranslationPageNode the translation page node to be configured as translation of aOriginalPageNode * @return true if aTranslationPageNode could be configured as translation of aOriginalPageNode, false otherwise. * @since Sitevision 4.3.2 */ setTranslatedFrom( aOriginalPageNode: Node, aTranslationPageNode: Node ): boolean; } declare namespace TranslationUtil {} declare var translationUtil: TranslationUtil; export default translationUtil;