From c9af6d1eb55e4a15ef8ce2cfc1341a30f9192f36 Mon Sep 17 00:00:00 2001 From: tsa96 Date: Sun, 5 Apr 2026 23:20:11 +0100 Subject: [PATCH] feat: expand definition of $.Localize --- shared/apis.d.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/shared/apis.d.ts b/shared/apis.d.ts index a67bd09..3808d26 100644 --- a/shared/apis.d.ts +++ b/shared/apis.d.ts @@ -265,13 +265,18 @@ declare namespace $ { /** * Localizes a string. + * If provided a panel, uses the dialog variables assigned to that panel in the output string. * @example * $.Localize('#Weapon_StickybombLauncher'); // Returns "Kleefbommenwerper" in Dutch in Momentum + * @example * $.Localize('#SomeNonexistentToken'); // Returns "#SomeNonexistentToken" + * @example + * const panel = $.CreatePanel('Panel', $.GetContextPanel(), ''); + * panel.SetDialogVariableInt('horses', 5); + * $.Localize('#HorseCount', panel); // If #HorseCount is "I have %d horse", returns "I have 5 horses" * @returns Localized string in the current language, if exists, otherwise the provided argument. - * @see [Example](https://github.com/momentum-mod/panorama/blob/721f39fe40bad57cd93943278d3a3c857e9ae9d7/scripts/hud/status.js#L47) */ - function Localize(str: string): string; + function Localize(str: string, panel?: GenericPanel): string; /** Localize a string, but return empty string if the localization token is not found */ function LocalizeSafe(str: string): string;