UNPKG

liferay-npm-bundler-preset-reactjs

Version:

liferay npm bundler preset react

58 lines (57 loc) 1.9 kB
/** * SPDX-FileCopyrightText: © 2020 Liferay, Inc. <https://liferay.com> * SPDX-License-Identifier: LGPL-3.0-or-later */ import { Project } from '.'; import FilePath from '../file-path'; /** StringsMaps indexed by locale */ export interface LocaleStringsMap { [index: string]: StringsMap; } /** Localized strings indexed by identifier */ export interface StringsMap { [index: string]: string; } /** FilePaths indexed by locale */ export interface LocaleFilePathMap { [index: string]: FilePath; } /** * Reflects localization configuration of JS Toolkit projects. */ export default class Localization { static readonly DEFAULT_LOCALE = "default"; constructor(project: Project); /** * Get the array of available locales for the project. * @return an array or `undefined` if L10N is not supported */ get availableLocales(): string[] | undefined; /** * Get the map of localized strings for a given locale. * @return a map or `undefined` if L10N is not supported */ getLabels(locale?: string): StringsMap | undefined; /** * Get the language file base name (absolute path plus name without * `.properties` extension). * @return a base file name or `undefined` if L10N is not supported */ get languageFileBaseName(): FilePath | undefined; /** * Get the map of localization FilePaths indexed by locale abbreviation. * @return a map or `undefined` if L10N is not supported */ get localizationFileMap(): LocaleFilePathMap | undefined; get supported(): boolean; /** * Get the locale of a .properties file based on its name */ _getFileNameLocale(fileName: string): string; private readonly _project; private readonly _supported; private _availableLocales; private _localeStringsMap; private _languageFileBaseName; private _localizationFileMap; }