mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-10-01 02:49:42 +00:00
Implémenter une app vue avec la liste des tickets attribués
This commit is contained in:
@@ -5,11 +5,16 @@ export type fetchOption = Record<string, boolean | string | number | null>;
|
||||
|
||||
export type Params = Record<string, number | string>;
|
||||
|
||||
export interface Pagination {
|
||||
first: number;
|
||||
items_per_page: number;
|
||||
more: boolean;
|
||||
next: string | null;
|
||||
previous: string | null;
|
||||
}
|
||||
|
||||
export interface PaginationResponse<T> {
|
||||
pagination: {
|
||||
more: boolean;
|
||||
items_per_page: number;
|
||||
};
|
||||
pagination: Pagination;
|
||||
results: T[];
|
||||
count: number;
|
||||
}
|
||||
|
@@ -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,
|
||||
|
Reference in New Issue
Block a user