sjaakp / yii2-pluto

User management extension for Yii2
https://demo.sjaakpriester.nl/
MIT License
8 stars 12 forks source link

Language #19

Open tresrob opened 4 years ago

tresrob commented 4 years ago

Hi sjaakp

I want to activate the Italian language. I have yii2 basic version installed and added the following code in the web.php file:

'i18n' => [ 'translations' => [ // ... other translations ... 'pluto' => [// override pluto's standard messages 'class' => 'yii \ i18n \ PhpMessageSource', 'basePath' => '@ app / messages', // this is a default 'sourceLanguage' => 'it-IT', // this as well ] ] ]

Unfortunately, it doesn't work, the Italian language doesn't change. can you help me please Thanks

ettolo commented 4 years ago

Try to put this in your config file:

'sourceLanguage' => 'en-US',
'language' => 'it-IT',
 'i18n' => [
            'translations' => [
                  'pluto' => [    // override pluto's standard messages
                     'class' => 'yii\i18n\PhpMessageSource',
                     'basePath' => '@app/messages',  // this is a default
                     'sourceLanguage' => 'en-US',    // this as well
                 ],
            ],
        ],
tresrob commented 4 years ago

Try to put this in your config file:

'sourceLanguage' => 'en-US',
'language' => 'it-IT',
 'i18n' => [
            'translations' => [
                  'pluto' => [    // override pluto's standard messages
                     'class' => 'yii\i18n\PhpMessageSource',
                     'basePath' => '@app/messages',  // this is a default
                     'sourceLanguage' => 'en-US',    // this as well
                 ],
            ],
        ],

Hi ettolo

Thanks for the reply. unfortunately it doesn't work. I only see the English language. I put it inside the config / web.php file.

ettolo commented 4 years ago

Hi, did you put the "it" folder in /messages?

tresrob commented 4 years ago

Hi, did you put the "it" folder in /messages?

Hi yes i copied it in vendor\yiisoft\yii2\messages\it and also in vendor\sjaakp\yii2-pluto\messages\it

but nothing

ettolo commented 4 years ago

no, if you have basic yii2 template you should create the folder in root, same level as config folder /messages/it/

tresrob commented 4 years ago

no, if you have basic yii2 template you should create the folder in root, same level as config folder /messages/it/

Ok i have created in root folder but this the result

immagine

not translate

in file /config/web.php i have insert

'sourceLanguage' => 'it-IT',
'language' => 'it-IT',
'timeZone' => 'UTC',

and 'components' => [ ... 'i18n' => [ 'translations' => [ 'pluto' => [ // override pluto's standard messages 'class' => 'yii\i18n\PhpMessageSource', 'basePath' => '@common/messages', // this is a default 'sourceLanguage' => 'it-IT', // this as well ], ], ],

ettolo commented 4 years ago
'basePath' => '@app/messages',  // **this is a default**
'sourceLanguage' => 'en-US',    // **this as well**
tresrob commented 4 years ago
'basePath' => '@app/messages',  // **this is a default**
'sourceLanguage' => 'en-US',    // **this as well**

hi ettolo i'm sorry

if i replace 'sourceLanguage' => 'it-IT', with 'sourceLanguage' => 'en-US',

this is the messagge

Invalid Argument – yii\base\InvalidArgumentException Invalid path alias: @common/messages

ettolo commented 4 years ago

You are not following my instuctions :-)

'basePath' => '@app/messages', // **this is a default**

@app not @common you don't have a common folder if you're using basic template

ettolo commented 4 years ago

in file /config/web.php i have insert

'sourceLanguage' => 'it-IT',
'language' => 'it-IT',
'timeZone' => 'UTC',

Also this is wrong! Leave sourceLanguage => 'us_US'

tresrob commented 4 years ago

You are not following my instuctions :-)

'basePath' => '@app/messages', // **this is a default**

@app not @common you don't have a common folder if you're using basic template

Ops i change with @app but not translate

i have copy a file pluto.php so

immagine

bring patience but I can't understand how to add the path

ettolo commented 4 years ago

the path is ok, have you done the other correction to web.php (_Leave sourceLanguage => 'usUS')?

tresrob commented 4 years ago

the path is ok, heva you done the other correction to web.php (_Leave sourceLanguage => 'usUS')?

BINGO!!!!!!!! ohhhhh yessss Thanks thanks thanks

ettolo commented 4 years ago

You're welcome!