Spittal / vue-i18n-extract

Manage vue-i18n localization with static analysis
https://pixari.github.io/vue-i18n-extract/#what-is-it
MIT License
313 stars 86 forks source link

Option to not generate nested keys when declaring a string with a dot #130

Closed vricosti closed 3 years ago

vricosti commented 3 years ago

Hi,

When I declare the following code to translate:

login.vue

<div class="login-wrap-title">
    <label>{{ $t('login.title') }}</label>
</div>

And I call yarn run vue-i18n-extract use-config I get the following output:

"login": {
    "title": ""
  },

Would it be possible to add an option to generate keys that are not nested ? Something like:

"login.title": ""

Maybe my request is coimpletely stupid (I come from a c++ background) but for some reason I would like to identify where is located the key. Of course an alternative is to use an underscore instead of a dot (login_title) but I found the dot to be more elegant.

DennisBetawerk commented 3 years ago

This would be required even to support the use case where Vuei18n is configured with formatFallbackMessages: true. We use this so that we can use the default language strings themselves as the keys.

vricosti commented 3 years ago

Is this project still maintained ? I have fixed an existing PR and updated code: https://github.com/pixari/vue-i18n-extract/pull/133

pixari commented 3 years ago

Hi @vricosti! Thank you for your support. v2.0 has been merged! 🥳

As soon as the conflicts will be fixed, we are going to merge the #133. :)

Thank you again!

Spittal commented 3 years ago

As of 2.0.1 you can set --separator as en empty string and that will achieve the functionality you want!