Skip to content

defect - dir(lng) method returning wrong direction for latn script language code #2324

@NorthernMoodler

Description

@NorthernMoodler

🐛 Bug Report

I'm working with a standard transliteration of the variant of Farsi spoken in Afghanistan. The transliteration is written using Latin script. The BCP-47 standard tag is "fa-Latn-AF".

To Reproduce

This is what I am getting. The first method correctly returns rtl as Farsi is a right-to-left language.
The second method incorrectly returns rtl as well. Latin script is always a left-to-right language.

i18next.dir('fa-AF'); // -> "rtl";
i18next.dir('fa-Latn-AF'); // -> "rtl";

Expected behavior

I should be getting 'ltr' in the second method call but I am getting 'rtl'.
I suspect that the dir method is ignoring the Latn script setting and just using the 'fa' language to decide direction.

i18next.dir('fa-AF'); // -> "rtl";
i18next.dir('fa-Latn-AF'); // -> "ltr";

Your Environment

  • runtime version: v22.14.0
  • i18next version: v25.2.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions