outl1ne / nova-translations-loader

This package helps with loading translations inside a Nova package.
MIT License
39 stars 39 forks source link

load global extra translations into NovaServiceProvider? #15

Open scramatte opened 1 year ago

scramatte commented 1 year ago

Hi,

I would like to use this package to add specific global application translation files. I want to achieve this to avoid to overwrite nova official translation.

I've created the following file

resources/lang/vendor/myapp/es.json And I load it into NovaServiceProvider

$this->loadTranslations(__DIR__ . '/../resources/lang/vendor', 'myapp', true);

Language file is loaded but labels are not translated on my resource page For example, I've got "Country" resource with the following method and strangely when I access to the resource only HTML title is translated. If I append a translation string into the main nova translation file, it works as expected.

   /**
    * Get the displayable label of the resource.
    *
    * @return string
    */ 
    public static function label()
    {
        return __('Countries');
    }

image

What I've missed?