Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Localize the numbers in diagrams #118

Open
mahozad opened this issue Dec 23, 2021 · 0 comments
Open

Localize the numbers in diagrams #118

mahozad opened this issue Dec 23, 2021 · 0 comments
Labels
Arch Applies to the classical layout, including the US enhancement

Comments

@mahozad
Copy link

mahozad commented Dec 23, 2021

The number(s) shown in the diagram always uses western Arabic numerals irrespective of the user locale.

Please update the code to generate alternative numbers for users with different locales (at least for my language Persian (also called Farsi) and also Arabic 😙). Note that Persian and Arabic numerals are different from each other.

This Wikipedia article and this can help.

Here is an example vector that shows the number based on the user (system) locale. The SVG shows Farsi (Persian) numerals if user locale matches Farsi, otherwise falls back to the default Western numerals for all other locales (the order in <switch> element matters).

I think in JavaScript, number.toLocaleString(Locale) can be used to produce localized numbers.

Below is an example.

index.html:

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Test</title>
<script src="script.js" defer></script>
</head>
<body>
  <h1>Farsi</h1>
  <p id="farsi"/>
  <hr>
  <h1>Arabic</h1>
  <p id="arabic"/>
</body>
</html>

script.js:

let num = 123456;
document.getElementById("farsi").innerHTML = num.toLocaleString("fa");
document.getElementById("arabic").innerHTML = num.toLocaleString("ar-EG");
@Gouvernathor Gouvernathor added enhancement Arch Applies to the classical layout, including the US labels May 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Arch Applies to the classical layout, including the US enhancement
Projects
None yet
Development

No branches or pull requests

2 participants