micheleangioni / laravel-js-lang-converter

Laravel lang files conversion to Javacript
MIT License
25 stars 8 forks source link

It does not work for files under folder #7

Closed eossa closed 8 years ago

eossa commented 8 years ago

A solution maybe can be something like this:

Lang.prototype._parseKey = function(key, locale) {
    if (typeof key !== 'string') {
        return null;
    }
    var segments = key.split('.');
    return {
        source: locale + '.' + segments[0].replace('/', '.'),
        entries: segments.slice(1)
    };
};

That in the source code, I overwrite that method in my own Js file:

Lang.__proto__._parseKey = function(key) {
    if (typeof key !== 'string') {
        return null;
    }
    var segments = key.split('.');
    return {
        source  : this.getLocale() + '.' + segments[0].replace('/', '.'),
        entries : segments.slice(1)
    };
};
micheleangioni commented 8 years ago

Hi @mrossa93 , excuse me for the late answer. Thanks for your contribution, I added the code in the last commit. Please give me a feedback by checking if it's now working for you, so that I can make a new release :)

eossa commented 8 years ago

Hi @micheleangioni thanks to you for your attention, when I execute the composer update the laravel-js-lang-converter version is 2.2.2, but I don't understand why the lang.js it's not update. Do you know why?

micheleangioni commented 8 years ago

@mrossa93 I didn't include that in the 2.2.2 version yet! :) The 2.2.2 version contains just a bug fix.

The updated lang.js it's only in the master branch, I wanted to wait your feedback before including the modification in a new tagged version :)

eossa commented 8 years ago

Ohh, I understand now 😄 I probe the master branch and it's correctly working!!!

micheleangioni commented 8 years ago

@mrossa93 Changes added to the new 2.3 version! Thanks again for your help! :)