1

Since the German translation of "Grid" within the german language pack is currently wrong (see here), I wanted to override it using a custom language pack (since you cannot override translations of translation packages within a module or a theme). I used the instructions provided here and also looked at the documentation.

This is what I have so far:

app/code/InspiredMinds/language-de_de/registration.php:

<?php

\Magento\Framework\Component\ComponentRegistrar::register(
    \Magento\Framework\Component\ComponentRegistrar::LANGUAGE,
    'InspiredMinds_de_de',
    __DIR__
);

app/code/InspiredMinds/language-de_de/language.xml:

<?xml version="1.0"?>
<language xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/Language/package.xsd">
    <code>de_DE</code>
    <vendor>InspiredMinds</vendor>
    <package>de_de</package>
    <use vendor="mageplaza" package="de_de" />
</language>

app/code/InspiredMinds/language-de_de/de_DE.csv:

"Grid","Raster",module,Magento_Catalog

Instead of

app/code/InspiredMinds/language-de_de

I also tried

app/i18n/InspiredMinds/de_de

I cleaned all caches and also ran a setup:di:compile (in case that is necessary for language packs). It still does not work.

What am I missing?

  • did u try to flush 'static file cache' in cache management in admin? for my case when translation is not working correctly flushing that helps. It is available only on developer mode. You also have the option to use the inline translation in admin panel. – Korbin Aug 15 '18 at 12:48
  • Clearing the static file cache did not help unfortunately. – fritzmg Aug 15 '18 at 13:04
1

As mentioned/suspected by @steros, there seems to be a bug with language packs regarding upper case letters within the component name. As far as I tested, the $componentName within registration.php must not contain uppercase letters (to fit the actual vendor and package name for example).

My above code works within

app/i18n/InspiredMinds/de_de

when I use all lower case letters as the component name in the registration.php:

\Magento\Framework\Component\ComponentRegistrar::register(
    \Magento\Framework\Component\ComponentRegistrar::LANGUAGE,
    'inspiredminds_de_de',
    __DIR__
);

Everything else can stay in camel cases.

0

Put everything in:

app/i18n/inspiredminds/de_de

registration:

<?php

\Magento\Framework\Component\ComponentRegistrar::register(
    \Magento\Framework\Component\ComponentRegistrar::LANGUAGE,
    'inspiredminds_de_de',
    __DIR__
);

xml:

<?xml version="1.0"?>
<language xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/Language/package.xsd">
    <code>de_DE</code>
    <vendor>Inspiredminds</vendor>
    <package>de_DE</package>
    <use vendor="magento" package="en_us" />
</language>

name your csv file de_DE.csv.

You need to run magento setup:static-content:deploy de_DE too depending on your setup.

  • That's what I already did, see my post. Whether I use InspiredMinds or inspiredminds should not matter, as long as I use the correct case in the registration.php and language.xml. – fritzmg Aug 15 '18 at 13:00
  • 1
    That's what I use and it works. There are some differences from your code. As far as I remember there is a bug where uppercase doesn't work. I never tried after upgrading if it still is the case though. – steros Aug 15 '18 at 13:01
  • Apart from the case I do not see many differences. Theme and module vendor names with camel case definitely work, so I don't think that's the problem. However, you used <use vendor="magento" package="en_us" />, but that's wrong, since I want to override <use vendor="mageplaza" package="de_de" />, isn't it? – fritzmg Aug 15 '18 at 13:04
  • Interestingly enough, it turns out there still is a case sensitivity issue - but only in the registration.php. While any other reference can be left in the camel case for example, the name of the language pack in the registration.php needs to be all lower case. – fritzmg Aug 16 '18 at 15:17
  • 1
    See, I said there's a difference and a case issue ;) – steros Aug 16 '18 at 15:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.