Which package is being used to handle translations?

pepijn
- 1 month ago

However, when I try to search for this package in the repository, nothing comes up. What's the approach here, has laravel-translatable been forked? Which version is being used ? Where can I view the dependency ? Etc. :) Thanks for any input on this, would like to make use of recent features in laravel-translatable

Answer

pepijn
- 1 month ago

@huglester

Thanks for the info! That's weird, it seems counter intuitive to me that PyroCMS has its own solution for this, which is almost entirely compatible with Dimsav/Laravel-translatable ! (I guess they're both based on the Symfony Translation package)

The feature I'm looking for is a country-based fallback. (es-mx should fallback to es, which should fallback to the default en)
(See 'country-based fallback' in the Laravel-Translatable readme)

Update: seems like this feature is actually handled by the Symfony package!
From the symfony docs:

Fallback Translation Locales¶

Imagine that the user's locale is fr_FR and that you're translating the key Symfony is great. To find the French translation, Symfony actually checks translation resources for several locales:
First, Symfony looks for the translation in a fr_FR translation resource (e.g. messages.fr_FR.xlf);
If it wasn't found, Symfony looks for the translation in a fr translation resource (e.g. messages.fr.xlf);
If the translation still isn't found, Symfony uses the fallbacks configuration parameter, which defaults to en (see Configuration).

huglester
- 1 month ago

PyroCMS has it's own translations solution. Neither I did find any dependencies of dimsav's sollution.

pepijn
- 1 month ago

Thanks for the info! That's weird, it seems counter intuitive to me that PyroCMS has its own solution for this, which is almost entirely compatible with Dimsav/Laravel-translatable ! (I guess they're both based on the Symfony Translation package)

The feature I'm looking for is a country-based fallback. (es-mx should fallback to es, which should fallback to the default en)
(See 'country-based fallback' in the Laravel-Translatable readme)

Update: seems like this feature is actually handled by the Symfony package!
From the symfony docs:

Fallback Translation Locales¶

Imagine that the user's locale is fr_FR and that you're translating the key Symfony is great. To find the French translation, Symfony actually checks translation resources for several locales:
First, Symfony looks for the translation in a fr_FR translation resource (e.g. messages.fr_FR.xlf);
If it wasn't found, Symfony looks for the translation in a fr translation resource (e.g. messages.fr.xlf);
If the translation still isn't found, Symfony uses the fallbacks configuration parameter, which defaults to en (see Configuration).