Marco
Marco

Reputation: 11

Magento 2.0 translation

I am - as a basic magento user - trying to translate to dutch, but it is not working as expected. I've had a clean install in 2.0.

What did I do?

  1. I've created a directory in app/i18n/test/nl_nl
  2. I've copied the files from vendor/magento/language-nl_nl to app/i18n/test/nl_nl and changed it to:

composer.json

{
    "name": "magento/language-nl_nl”,
    "description": "Dutch (Netherlands) language",
    "version": "100.0.2",
    "license": [
        "OSL-3.0",
        "AFL-3.0"
    ],
    "require": {
        "magento/framework": "100.0.*"
    },
    "type": "magento2-language",
    "autoload": {
        "files": [
            "registration.php"
        ]
    }
}

Language.xml

<?xml version="1.0"?>
<!--
/**
 * Copyright © 2015 Magento. All rights reserved.
 * See COPYING.txt for license details.
 */
-->
<language xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/Language/package.xsd">
    <code>nl_NL</code>
    <vendor>magento</vendor>
    <package>nl_nl</package>
</language>

Registration.php

<?php
/**
 * Copyright © 2015 Magento. All rights reserved.
 * See COPYING.txt for license details.
 */

\Magento\Framework\Component\ComponentRegistrar::register(
    \Magento\Framework\Component\ComponentRegistrar::LANGUAGE,
    'nl_nl',
    __DIR__
);
  1. I've added a nl_NL.csv file "Search entire store here...","Zoek TESTING..."

  2. Cached

And ... Nothing! Anybody willing to hint me a clue this christmas?

Thank in advance!

Upvotes: 0

Views: 2268

Answers (2)

Anse
Anse

Reputation: 1660

I'm unsure what's the right way to translate strings in Magento 2, but I succeeded with the following simple approach for a German translation:

  • copied vendor/magento/module-catalog/i18n/en_US.csv to vendor/magento/module-catalog/i18n/de_DE.csv
  • opened de_DE.csv in a text editor and translated the values in the second column
  • same approach for the several other i18n/*.csv files in other modules

Upvotes: 0

Marco
Marco

Reputation: 11

Yes, two error in above text:

  1. magento must be test in language.xml
  2. 'nl_nl' must be 'test_nl_nl' in Registration.php

Now it Works!

Upvotes: 1

Related Questions