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

Getting direction #454

Open
doneumark opened this issue Feb 14, 2021 · 1 comment
Open

Getting direction #454

doneumark opened this issue Feb 14, 2021 · 1 comment

Comments

@doneumark
Copy link

Hi! thanks for this wonderful library.
Is there a way to get the direction (rtl/ltr) of the language like in i18n? (i18.dir())

@mashpie
Copy link
Owner

mashpie commented Feb 14, 2021

Hi @doneumark!

I'm afraid that such a feature currently doesn't exist. But you might consider setting a special "direction-key" within your language files to come around that, for example:

// en.json
{
  "_dir": "ltr",
  "greeting": "Welcome"
} 
// ar.json
{
  "_dir": "rtl",
  "greeting": "أهلا بك"
} 

And use __() to read out the according value per language:

  const dir = req.__('_dir')

Now, you have complete control of that setting per language.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants