localization issues

Help for integrating the Laravel package
Forum rules
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
godadada@yahoo.com
Posts: 56
Joined: 15 Mar 2021, 01:03

localization issues

Post by godadada@yahoo.com » 03 Sep 2021, 01:13

Greetings,

I am testing aimeos 21.07 on Ubuntu 20.*, trying to make localization work. The *.po files under admin extension works, but not other location. Please help pointing out potential issues, or examples I may refer if you can.
Yes I used commands:
composer dump-autoload
msgfmt --statistics -c -o zh_CN zh_CN.po

Here is my configuration:
composer.json:
......
"classmap": [
"database/seeds",
"database/factories",
"ext/small-ext/controller/frontend/src",
"ext/small-ext/controller/jobs/src",
"ext/small-ext/controller/common/src",
"ext/small-ext/client/html/src",
"ext/small-ext/client/jsonapi/src",
"ext/small-ext/lib/custom/src",
"ext/small-ext/admin/jsonadm/src",
"ext/small-ext/admin/jqadm/src"
]
........


Here is the customizing extension file for localization:
ext/small-ext/admin/jsonadm/i18n/ext/zh_CN.po
ext/small-ext/admin/jsonadm/i18n/zh_CN.po
ext/small-ext/admin/i18n/ext/zh_CN.po
ext/small-ext/admin/i18n/zh_CN.po
ext/small-ext/controller/frontend/i18n/zh_CN.po
ext/small-ext/controller/jobs/i18n/zh_CN.po
ext/small-ext/controller/common/i18n/zh_CN.po
ext/small-ext/client/jsonapi/i18n/zh_CN.po
ext/small-ext/client/i18n/code/zh_CN.po
ext/small-ext/client/i18n/zh_CN.po

User avatar
aimeos
Administrator
Posts: 7873
Joined: 01 Jan 1970, 00:00

Re: localization issues

Post by aimeos » 04 Sep 2021, 06:52

Did you use "msgfmt" for all .po files separately?
Does your ./ext/small-ext/manifest.php contains all directories you use in the "i18n" section?
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

godadada@yahoo.com
Posts: 56
Joined: 15 Mar 2021, 01:03

Re: localization issues

Post by godadada@yahoo.com » 06 Sep 2021, 11:58

Thanks for the hints.
I think I may have missed something in regard to your second hint. I will check on both.

Regards

godadada@yahoo.com
Posts: 56
Joined: 15 Mar 2021, 01:03

Re: localization issues

Post by godadada@yahoo.com » 07 Sep 2021, 23:04

Greetings,

I made progress, but have a new issue.

Recall that the issue I had was localization for admin works, but nothing else.
I changed all 'route' function calls under resources/view to 'airoute', e.g. route('aimeos_shop_admin') to airoute(aimeos_shop_admin'). Now I have opposite issue, localization under admin is not working, but others do.

I do not fully understand why. I guess it has something to do with CMS, as I am using it for admin panel.

Regards

User avatar
aimeos
Administrator
Posts: 7873
Joined: 01 Jan 1970, 00:00

Re: localization issues

Post by aimeos » 09 Sep 2021, 05:33

Why did you change form route() to airoute() and in which file/line did you change that?
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

godadada@yahoo.com
Posts: 56
Joined: 15 Mar 2021, 01:03

Re: localization issues

Post by godadada@yahoo.com » 10 Sep 2021, 11:58

Thanks for the response.
I checked 21.07 version of aimeos/aimeos, it uses airoute calls instead of route under resources/view. the best I can do to find the airoute definition is here https://scrutinizer-ci.com/g/aimeos/aim ... on/airoute. airoute works better than route for me. Please enlighten if you can.

The latest discovery after using airoute for aimeos_shop_admin is that the fault is not with localization but with the url slug with locale parameter wrong for admin only. This means the issue can be isolated to admin/cms. by the way i am using codezero/laravel-localizer for locale detection, where url slug has highest priority. I would like to know where the locale parameter is generated.

Regards,

godadada@yahoo.com
Posts: 56
Joined: 15 Mar 2021, 01:03

Re: localization issues

Post by godadada@yahoo.com » 11 Sep 2021, 06:36

I think I found a solution, change admin extension to make it consistent with others, e.g. client. Here is the file diff and file path info.

dude@galaxy:~/small/ext/small-ext/admin/jqadm/templates/common$ diff page-standard.php ~/small/vendor/aimeos/ai-admin-jqadm/admin/jqadm/templates/common/page-standard.php
138a139,140
>
>
139a142
> <div class="aimeos" lang="<?= $this->param( 'locale' ) ?>" data-url="<?= $enc->attr( $this->url( $jsonTarget, $jsonCntl, $jsonAction, array( 'site' => $site ), [], $jsonConfig ) ) ?>">
141d143
< <div class="aimeos" data-url="<?= $enc->attr( $this->url( $jsonTarget, $jsonCntl, $jsonAction, $params, [], $jsonConfig ) ) ?>">


I do not have deep understanding, but a simple common sense, admin behaves differently from other pages, also the code for the data-url is different too. I made the code consistent, so they worked. I have tried different versions of aimeos/aimeos, 18, 19.20, 21. they all have this issue.

Regards

User avatar
aimeos
Administrator
Posts: 7873
Joined: 01 Jan 1970, 00:00

Re: localization issues

Post by aimeos » 11 Sep 2021, 09:07

I think your problem is that you've added the {locale} parameter to /admin route too. If you remove that again, it will work as expected.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

godadada@yahoo.com
Posts: 56
Joined: 15 Mar 2021, 01:03

Re: localization issues

Post by godadada@yahoo.com » 11 Sep 2021, 09:16

Thanks. I will remember that. I have a working version now, do not want change unless it is broken again.

Regards,

Post Reply