fix(client/rtl): tooltips not inverted

This commit is contained in:
Elian Doran
2025-10-08 19:06:19 +03:00
parent 9d1e89268f
commit b5f73874cb
6 changed files with 29 additions and 14 deletions

View File

@@ -869,6 +869,18 @@ export function getErrorMessage(e: unknown) {
}
}
/**
* Handles left or right placement of e.g. tooltips in case of right-to-left languages. If the current language is a RTL one, then left and right are swapped. Other directions are unaffected.
* @param placement a string optionally containing a "left" or "right" value.
* @returns a left/right value swapped if needed, or the same as input otherwise.
*/
export function handleRightToLeftPlacement<T extends string>(placement: T) {
if (!glob.isRtl) return placement;
if (placement === "left") return "right";
if (placement === "right") return "left";
return placement;
}
export default {
reloadFrontendApp,
restartDesktopApp,