Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Language #19

Open
tresrob opened this issue Apr 8, 2020 · 14 comments
Open

Language #19

tresrob opened this issue Apr 8, 2020 · 14 comments

Comments

@tresrob
Copy link

tresrob commented Apr 8, 2020

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
Copy link

ettolo commented Apr 8, 2020

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
Copy link
Author

tresrob commented Apr 8, 2020

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
Copy link

ettolo commented Apr 9, 2020

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

@tresrob
Copy link
Author

tresrob commented Apr 9, 2020

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
Copy link

ettolo commented Apr 9, 2020

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

@tresrob
Copy link
Author

tresrob commented Apr 9, 2020

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
Copy link

ettolo commented Apr 9, 2020

'basePath' => '@app/messages',  // **this is a default**
'sourceLanguage' => 'en-US',    // **this as well**

@tresrob
Copy link
Author

tresrob commented Apr 9, 2020

'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
Copy link

ettolo commented Apr 9, 2020

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
Copy link

ettolo commented Apr 9, 2020

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
Copy link
Author

tresrob commented Apr 9, 2020

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
Copy link

ettolo commented Apr 9, 2020

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

@tresrob
Copy link
Author

tresrob commented Apr 9, 2020

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

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

@ettolo
Copy link

ettolo commented Apr 9, 2020

You're welcome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants