@ledgerhq/live-common
Version:
Common ground for the Ledger Live apps
25 lines • 1.51 kB
TypeScript
type Config = {
currentLanguage: string;
defaultLanguage: string;
languages: Record<string, string>;
};
export declare const BASE_LEDGER_SUPPORT = "https://support.ledger.com";
export declare const LEDGER = "https://www.ledger.com";
export declare const SHOP = "https://shop.ledger.com";
export declare const SALESFORCE_SUPPORT = "https://support.ledger.com/article";
/**
* Constructs a localized URL based on the provided base URL, language, default language, and optional suffix.
* If the language is the default language, the language part is omitted from the URL.
*
* @param {string} baseUrl - The base URL (e.g., "https://www.ledger.com").
* @param {LanguageMap} langMap - A mapping of language codes to their respective language identifiers (e.g., { en: "en", fr: "fr", ... }).
* @param {keyof LanguageMap} lang - The selected language code (e.g., "en", "fr").
* @param {string} DEFAULT_LANGUAGE - The default language configuration(e.g., "en").
* @param {string} [suffix=""] - An optional suffix to append to the URL (e.g., "article/123").
*
* @returns {string} - The localized URL, including the language part (if applicable) and any suffix.
*/
export declare const getLocalizedUrl: (baseUrl: string, langMap: Record<string, string>, lang: string, defaultLanguage: string, suffix?: string) => string;
export declare const useLocalizedUrl: (url: string, { languages, defaultLanguage, currentLanguage }: Config) => string;
export {};
//# sourceMappingURL=useLocalizedUrl.d.ts.map