Implémenter une app vue avec la liste des tickets attribués

This commit is contained in:
Boris Waaub
2025-07-18 16:06:16 +00:00
committed by Julien Fastré
parent 6594d4f6a6
commit 61d1232e31
28 changed files with 1068 additions and 388 deletions

View File

@@ -8,6 +8,26 @@ import { TranslatableString } from "ChillMainAssets/types";
* @param locale defaults to browser locale
* @returns The localized string or null if no translation is available
*/
/**
* Prepends the current HTML lang code to the given URL.
* Example: If lang="fr" and url="/about", returns "/fr/about"
*
* @param url The URL to localize
* @returns The localized URL
*/
export function localizedUrl(url: string): string {
const lang =
document.documentElement.lang || navigator.language.split("-")[0] || "fr";
// Ensure url starts with a slash and does not already start with /{lang}/
const normalizedUrl = url.startsWith("/") ? url : `/${url}`;
const langPrefix = `/${lang}`;
if (normalizedUrl.startsWith(langPrefix + "/")) {
return normalizedUrl;
}
return `${langPrefix}${normalizedUrl}`;
}
export function localizeString(
translatableString: TranslatableString | null | undefined,
locale?: string,