lifeart/ember-language-server

implement /config/intl.js execution to get intl configurations (translations location, nesting, default locations, etc)

lifeart opened this issue · 2 comments

implement /config/intl.js execution to get intl configurations (translations location, nesting, default locations, etc)

Hi @lifeart. Have you had any thoughts about how this might be implemented. I'm currently exploring improving this project to support translation keys that use the folder structure to namespace keys, ie for translations/foo/bar/en.yml -> foo.bar.some.key instead of some.key which is what is supported currently.

In order to know whether we should be namespacing the keys we need to get access to the config/ember-intl.js file, in particular the wrapTranslationsWithNamespace property.

Wondering if you've put any thought in to how we might go about doing this?

(For reference, I've started knocking together a PR to explore what needs to be done to actually namespace the keys. It's a proof of concept more than anything as I've not written any language server code before. Just an FYI.

Hi @achambers! Thank you for your initiative! I think it's really good!

Simplest way is to do dynamic "import" for this file, later, we could use worker_threads to isolate it.
Take a look on how we load environment.js right now: https://github.com/lifeart/ember-language-server/blob/component-context-info-origin/src/utils/layout-helpers.ts#L87