Coder Social home page Coder Social logo

Comments (1)

vthibault avatar vthibault commented on May 20, 2024

The main reasons we didn't add support for nested objects are the following :

  • What happened if we ask in your example t('fruits') ? Handled by onMissingKey() ?
  • What happened if we currently have a key named "fruits.apple" in the table ? Which one should have priority, the key or the nested resolution ?
  • Need some checks to avoid TypeError t('fruits.undefinedKey.typeerror') or object escaping t('fruits.constructor.constructor.name') === 'Function'
  • Need to implement nested support in extends function.
  • To keep the implementation fast and avoid re-parsing the key at each call, we need to store the generated function in an inline cache object (cache['fruits.apple'] = <generated function>) leading to problems while updating the table, deleting parent of nested entries or erasing the parent with a string.

For this reason, and because I don't really get the point of nested objects except developers comfort, we didn't feel the need to implement it in the first version.

But still, it's on the roadmap, even if I'm not sure about the first two questions.

from frenchkiss.js.

Related Issues (12)

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.