0

I have a custom theme in magento2.1. I have created a category and added one product under it. When I go to the category page to view that product in list, I got an error saying,

1 exception(s):
Exception #0 (Exception): File "/i18n/en_US.csv" does not exist

Exception #0 (Exception): File "/i18n/en_US.csv" does not exist

From the error I understood that the language file is not existing. So I copied the language folder, ie : i18n folder from

vendor\magento\theme-frontend-blank

and pasted it in my

app\design\frontend\custom\theme

Then I deployed the static files. Still the error is showing. And homepage is working fine. Can any one please help me to sort it out?

hakkim
  • 666
  • 15
  • 36

1 Answers1

0

For i18n You can make it like this

  • Make folder named with i18n in app folder

  • Make sub folder same name as your theme like custom in i18n folder

  • Make language pack folder(s) in i18n -> custom folder like en_us or en_gb

  • Now your folder structure will like this app/i18n/custom/en_us/

Now in this your language package folder make below files, all files will be in this folder structure app/i18n/custom/en_us/

app/i18n/custom/en_us/composer.json

{
    "name": "custom/en_us",
    "description": "English (US) language",
    "version": "100.0.1",
    "license": [
        "OSL-3.0",
        "AFL-3.0"
    ],
    "require": {
        "magento/framework": "100.0.*"
    },
    "type": "magento2-language",
    "autoload": {
        "files": [
            "registration.php"
        ]
    }
}

app/i18n/custom/en_us/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>en_US</code>
    <vendor>custom</vendor>
    <package>en_us</package>
</language>

app/i18n/custom/en_us/registration.php

<?php
/**
 * Copyright © 2016 Magento. All rights reserved.
 * See COPYING.txt for license details.
 */
\Magento\Framework\Component\ComponentRegistrar::register(
    \Magento\Framework\Component\ComponentRegistrar::LANGUAGE,
    'custom_en_us',
    __DIR__
);

After this put your en_US.csv in your language pack folder

  • app/i18n/custom/en_us/en_US.csv

After than run this following commands

  • php bin/magento setup:upgrade
  • php bin/magento setup:static-content:deploy
  • php bin/magento cache:clean

Hope this will helps you

Nirav Joshi
  • 2,924
  • 1
  • 23
  • 45