@cesdk/cesdk-js 1.59.0-rc.0 → 1.59.1-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.d.ts CHANGED
@@ -2037,6 +2037,32 @@ export declare class InternationalizationAPI {
2037
2037
  * @returns An object mapping locale strings to their respective translations.
2038
2038
  */
2039
2039
  getTranslations(locales?: LocaleKey[]): Partial<Record<LocaleKey, Partial<Translations>>>;
2040
+ /**
2041
+ * Translates a key or array of keys to the current locale.
2042
+ *
2043
+ * This method retrieves the translation for the given key(s) in the currently
2044
+ * active locale. When an array of keys is provided, the first key that has a
2045
+ * translation will be used. If no translation is found for any of the provided
2046
+ * keys, the last key in the array (or the single key if a string is provided)
2047
+ * will be returned as the fallback value.
2048
+ *
2049
+ * @category Localization
2050
+ * @param key - A translation key string or an array of translation keys to try in order.
2051
+ * @returns The translated string for the key in the current locale, or the key itself if no translation is found.
2052
+ *
2053
+ * @example
2054
+ * ```
2055
+ * // Single key
2056
+ * const translation = cesdk.i18n.translate('common.save');
2057
+ * // Returns: "Save" (if translation exists) or "common.save" (if not found)
2058
+ *
2059
+ * // Array of keys (fallback)
2060
+ * const translation = cesdk.i18n.translate(['specific.save', 'common.save']);
2061
+ * // Tries 'specific.save' first, then 'common.save'
2062
+ * // Returns the first found translation or "common.save" if neither exists
2063
+ * ```
2064
+ */
2065
+ translate(key: string | string[]): string;
2040
2066
  }
2041
2067
 
2042
2068
  /**