conedevelopment / i18n

Push your Laravel translations to the front-end and use them easily with JavaScript.
https://pineco.de/using-laravels-localization-js/
MIT License
129 stars 21 forks source link

patch #1 #3

Closed ctf0 closed 6 years ago

ctf0 commented 6 years ago

this is based on https://github.com/thepinecode/i18n/issues/2

because blade cache the views, it means that getting the locale b4 rendering is useless as it will remain the same unless you clear the view cache each time the user switch the language.

'auth' : { // file name
  'required': { // key
    en: 'english text', // locale
    fr: 'french text'
  }
}


in patch # 2

i've tried

var data = $data

window.translations = function(item) {
  return data[item][lang]
}

but it doesnt work because it should be interpreted as data.auth.failed not data.'auth.failed' as one key "any help is appreciated"

iamgergo commented 6 years ago

@ctf0 instead of PR we pushed a new release, you can check the changes there!