You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Automatic Eastern Arabic numerals in Arabic translations?H #583
I'm having trouble finding documentation for this on projectfluent.org.
Given a Fluent translation in Arabic, and passing in an integer for the score...
feedback-score = لقد حصلت على {$SCORE} أشكال صحيحة.
Is there a way to convert the score to an eastern arabic numeral? I'm expecting to see لقد حصلت على ١٠ أشكال صحيحة. instead of لقد حصلت على 10 أشكال صحيحة..
I'm using @fluent/react for this.
MVP (ignoring cardinality variants for brevity):
import{FluentBundle,FluentResource}from"@fluent/bundle";import{ReactLocalization,LocalizationProvider}from"@fluent/react";functiongetTranslationResources(){return{"ar": newFluentResource("feedback-score = لقد حصلت على {$SCORE} أشكال صحيحة."),"en-GB": newFluentResource("feedback-score = You got {$SCORE} shapes right.")};}constTRANSLATION_RESOURCES=getTranslationResources();function*generateBundle(locale){constbundle=newFluentBundle(locale);bundle.addResource(TRANSLATION_RESOURCES[locale]);yieldbundle;}functionl10n(locale){returnnewReactLocalization(generateBundle(locale));}functionComponent(){return(<LocalizationProviderl10n={l10n("ar")}><Localizedid="feedback-score"vars={{SCORE: 12}}/></LocalizationProvider>);}
Activity
Pike commentedon Feb 15, 2022
This might be a bug. I've created a POC on https://projectfluent.org/play/?id=866991f31481b7590e6851ab103aed6a, and it renders the latin-ish arabic numbers. If I switch the language from Arabic to Breton and back to Arabic, it shows the arabic arabic number literal.
That's weird, no idea if that's a thing in playground or in fluent bundle or ...
test(bundle): Add test for customizing numbering system (#583)
test(bundle): Add test for customizing numbering system (#583)
test(bundle): Add test for customizing numbering system (#583)