1

I have 3 languages in my site English, Danish and Swedish.I have created i18n folder in Magento_root/app path and I have language.xml, composer.json, da_DK.csv and registration.php files inside da_DK folder inside Locale folder which is in i18n folder Magento_root/app/i18n/Locale/da_DK/.

Translation is working perfectly for Danish. Likewise I have created the same structure for Swedish, but unfortunately, it did not work for Swedish. Path for Swedish Magento_root/app/i18n/Locale/sv_SE/

Magento_root/app/i18n/Locale/sv_SE/composer.json

{
"name": "Locale/language-sv_se",
"description": "Swedish Language",
"version": "100.0.2",
"license": [
"OSL-3.0",
"AFL-3.0"
],
"require": {
"magento/framework": "100.0.*"
},
"type": "magento2-language",
"autoload": {
"files": [
"registration.php"
]
}
}

Magento_root/app/i18n/Locale/sv_SE/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>sv_SE</code>
<vendor>locale</vendor>
<package>sv_se</package>
</language>

Magento_root/app/i18n/Locale/sv_SE/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,
'locale_sv_SE',
__DIR__
);

Magento_root/app/i18n/Locale/sv_SE/sv_SE.csv

"SIGN UP","BLI MEDLEM"
"LOG IN","logga in"
"LOG OUT","LOGGA UT"

I don't know really why the same way is working for Danish and not for Swedish. Can anyone please help me out here?

Here Danish is working but Swedish not working

My folder structure is in the above screenshot, I don't know what I did wrong, Can anyone please help me out here?

1 Answer 1

1

After lots of search I have found a solution for this. I have just rearranged the folder structure and it works fine. I have renamed the "Locale" folder to danish Magento_root/app/i18n/danish/da_DK/ and created a folder named swedish Magento_root/app/i18n/swedish/sv_SE/ and placed the files inside it. Now both the languages working fine. It may help someone in future. Thanks :)

1
  • can u show ur language admin local option? can u plz provide code link
    – matinict
    Commented Apr 1, 2018 at 10:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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