question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Allow message keys to contain dots

See original GitHub issue

Basically no Ember-related i18n library does allow dots in message keys, but I’ve found relying solely to Ember.get a bit counter-intuitive. Granted, the implementation is simpler, since it’s a core Ember tool to fetch key paths and is working pretty well, but most of the i18n backeds use a key-value store like Redis. Therefore, when fetching the translations from the server, these messages must be un-flattened first to build up a hierarchical JS object structure, something Ember i18n libraries can deal with.

Instead, just serializing a KV table into

{
  "product.info": "{product} will cost {price, number, EUR} if ordered by {deadline, date, time}",
  "product.html.info": "<strong>{product}</strong> will cost <em>{price, number, EUR}</em> if ordered by {deadline, date, time}"
}

is much more straightforward on the server then the currently required

{
  "product": {
    "info": "{product} will cost {price, number, EUR} if ordered by {deadline, date, time}",
    "html": {
      "info": "<strong>{product}</strong> will cost <em>{price, number, EUR}</em> if ordered by {deadline, date, time}"
    }
  }
}

While the filesize is somewhat bigger by default, it is negligible when gzipped. Also, the former speeds up message lookups as a byproduct.

As these two semantics are not mutually exclusive (exact key lookup first, then fall back to Ember.get), I see no disadvantage in supporting both.

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
jasonmitcommented, Mar 16, 2016

As of 2.5.x, ember g ember-intl-dot-notation enables support for this w/o having to manually override internals.

0reactions
zeppelincommented, Mar 16, 2016

C’est magnifique 👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

messages.properties keys with multiple dots not working
I can access the keys and use them if they have a single name. Chaining keys for the same category and dividing them...
Read more >
How to make the middle dot (·) on your keyboard
Make the middle dot / median dot (·) on Mac / MacBook :​​ The technique: Keep the Option ⌥ and ⇧ Shift keys...
Read more >
No dot allowed in key name, how to create an email index?
I'm trying to create an email_index with paths like email_index/f...@bar.com which would have the user associated with that email. It seems no dots...
Read more >
Unable to insert a dot '.' in a nested key via pymongo - MongoDB
I'm working with python and trying to insert a dict into one of my fields but I get an error message when trying...
Read more >
Allow "." (dot) in a variable key | Bitbucket Cloud - Jira
We tried to use single and double quotas for the key and also to escape the dot with \. but the same message...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found