GithubHelp home page GithubHelp logo

Contexts not working? about i18njs HOT 3 CLOSED

roddeh avatar roddeh commented on September 1, 2024
Contexts not working?

from i18njs.

Comments (3)

roddeh avatar roddeh commented on September 1, 2024

The documentation was perhaps misleading in that it assumes that the values will be "added" to the instance of i18n e.g.

i18n.translator.add(
  {
  "values":{
    "Yes": "Yes",
    "No": "No"
  },
  "contexts":[
    {
      "matches":{
        "gender":"male"
      },
      "values":{
          "%{name} updated their profile":
          "%{name} updated his profile"
      }
    },
    {
      "matches":{
        "gender":"female"
      },
      "values":{
        "%{name} updated their profile":
        "%{name} updated her profile"
      }
    }
  ]
});

Given the issue was closed, I suspect you came to the same solution ;)

Let me know if you continue to have issues.

from i18njs.

jmle avatar jmle commented on September 1, 2024

Thank you @roddeh, it was actually something completely unrelated to the library... The docs are quite clear actually. My mistake!

from i18njs.

roddeh avatar roddeh commented on September 1, 2024

No problem, I hope the library meets your i18n needs!

from i18njs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.