@sap-ux/ui-components
Version:
SAP UI Components Library
65 lines • 2.77 kB
TypeScript
import type { I18nBundle, TranslationEntry } from './UITranslationButton.types.js';
import { TranslationKeyGenerator, TranslationTextPattern } from './UITranslationButton.types.js';
/**
* Method extracts i18n binding and returns key of i18n entry.
*
* @param value Binding value.
* @param patterns Check if method should resolve syntax annotation based i18n binding.
* @param prefixes Allowed prefixes for single bracket pattern.
* @returns {string | undefined} I18n entry key or undefined if input does not matches i18n binding pattern.
*/
export declare const extractI18nKey: (value: string, patterns: TranslationTextPattern[], prefixes: string[]) => string | undefined;
/**
* Convert to camel case.
* It gets input like 'product details info' and convert it to 'productDetailsInfo'.
*
* @param input Value to convert.
* @param maxWord Maximal cxount of words to convert.
* @returns Canverted value.
*/
export declare const convertToCamelCase: (input?: string, maxWord?: number) => string;
/**
* Convert to pascal case.
* It gets input like 'product details info' and convert it to 'ProductDetailsInfo'.
*
* @param input Value to convert.
* @param maxWord Maximal cxount of words to convert.
* @returns Canverted value.
*/
export declare const convertToPascalCase: (input: string, maxWord?: number) => string;
/**
* Generates a unique i18n key for the text.
* It considers currently active bundle and translation key generator.
*
* @param text
* @param translationKeyGenerator
* @param bundle
* @returns Generated i18n key.
*/
export declare function generateI18nKey(text: string, translationKeyGenerator: TranslationKeyGenerator, bundle: I18nBundle): string;
/**
* Method to apply passed pattern for passed key.
*
* @param key I18n key.
* @param pattern I18n pattern.
* @param prefix Prefix for single bracket pattern.
* @returns Generated i18n value for passed pattern.
*/
export declare const applyI18nPattern: (key: string, pattern: TranslationTextPattern, prefix: string) => string;
/**
* Method finds first existing i18n key searching by key.
*
* @param {I18nBundle} bundle Search for value.
* @param {string} key Search for key.
* @returns {TranslationEntry | undefined} Key if value is found.
*/
export declare const getTranslationByKey: <T extends TranslationEntry>(bundle: I18nBundle<T>, key: string) => T | undefined;
/**
* Method finds existing i18n key searching by value.
*
* @param {I18nBundle} bundle Search for value.
* @param {string} value Search for value.
* @returns {TranslationEntry | undefined} Key if value is found.
*/
export declare const getTranslationByText: <T extends TranslationEntry>(bundle: I18nBundle<T>, value: string) => T | undefined;
//# sourceMappingURL=UITranslationUtils.d.ts.map