Translation with $this->context()->i18n()->dt() not working

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!
kdim95
Advanced
Posts: 195
Joined: 26 Aug 2022, 12:17

Translation with $this->context()->i18n()->dt() not working

Post by kdim95 » 14 Mar 2023, 14:04

Laravel framework version: 9.52.4
Aimeos Laravel version: ~2022.10
PHP Version: 8.2.3
Environment: Linux

Hello,

I've created a new decorator in the namespace Aimeos\MShop\Order\Manager\Base\Service\Decorator.

I'm attempting to translate this country code inside the search() method:
dump( $this->context()->i18n()->dt( 'client', 'AZ') )

The translation does not work, it returns AZ, when it should return Azerbaijan.

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

Re: Translation with $this->context()->i18n()->dt() not working

Post by aimeos » 14 Mar 2023, 16:35

You are using the wrong translation domain and it should be instead:

Code: Select all

$this->context()->translate( 'country', 'AZ' );
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

kdim95
Advanced
Posts: 195
Joined: 26 Aug 2022, 12:17

Re: Translation with $this->context()->i18n()->dt() not working

Post by kdim95 » 15 Mar 2023, 13:34

Thank you, I did have the wrong domain. It works now.

Post Reply