How to use translation from client.fa_IR.yml in javascript code?


(SMHassanAlavi) #1

I wrote a plugin and I want to use some of the strings in config/locales/client.fa_IR.yml in my java script code(NOT handlebars) but I don’t know how?
Can anyone help me?
For exmaple I have:

fa_IR:
  js:
    user:
      reputation: "اعتبار شما"

And I want to use the string in my java script code.


(Alan Tan) #2

Once the locale on your instance is set to fa_IR via the site setting, you can access that translation via I18n.t("user.reputation'').