gen-jhipster
Version:
Spring Boot + Angular/React/Vue in one handy generator
84 lines (83 loc) • 2.75 kB
TypeScript
/**
* Copyright 2013-2024 the original author or authors from the JHipster project.
*
* This file is part of the JHipster project, see https://www.jhipster.tech/
* for more information.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Converts xx-yy to xx_yy.
* @param language
* @returns
*/
export declare function languageSnakeCase(language: any): any;
/**
* Convert a language tag to java locale tag.
* @param language
* @returns
*/
export declare function languageToJavaLanguage(language: any): any;
type specificLocales =
/**
* Locale id fallback for java.
* Tags can be found at [Java 17 locales tags](https://www.oracle.com/java/technologies/javase/jdk17-suported-locales.html#modules)
*/
'javaLocaleMessageSourceSuffix'
/**
* Locale id fallback for angular.
* Tags can be found at https://www.npmjs.com/package/@angular/common?activeTab=explore
*/
| 'angularLocale'
/**
* Locale id fallback for [dayjs](https://github.com/iamkun/dayjs).
* Tags can be found at https://www.npmjs.com/package/dayjs?activeTab=explore
*/
| 'dayjsLocale'
/**
* Locale for fakerjs.
* Available locales can be found at https://github.com/faker-js/faker/tree/next/src/locales
*/
| 'fakerjsLocale';
type BaseLanguage = {
/**
* BCP 47 formatted language tag.
*/
readonly languageTag: string;
/**
* English name.
*/
readonly name: string;
/**
* Language name in the original language.
*/
readonly displayName: string;
/**
* Language is right-to-left.
*/
readonly rtl: boolean;
};
export type Language = BaseLanguage & Readonly<Record<specificLocales, string | null>>;
export declare const supportedLanguages: readonly Language[];
export declare const findLanguageForTag: (languageTag: string, languages?: readonly Language[]) => Language | undefined;
export declare const defaultLanguage: Required<Language>;
/**
* Generate language objects in array of "'en': { name: 'English' }" format
* @param languages
*/
export declare const generateLanguagesWebappOptions: (languages: readonly Language[]) => string[];
export declare function languagesAsChoices(languages?: readonly Language[]): {
value: string;
name: string;
}[];
export {};