0

I'm trying to create a custom language module to change cart to basket.

The following code currently sits is app/code/atharna/en_us.

The code I have created so far is as follows:

composer.json

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

en_US.csv

"Add to Cart","Add to Basket"
"Shopping Cart","Shopping Basket"
"You added %1 to your shopping cart.","You added %1 to your shopping Basket."
"Shopping Cart Items","Shopping Basket Items"
"My Cart (1 item)","My Basket (1 item)"
"My Cart (%1 items)","My Basket (%1 items)"
"My Cart","My Basket"
"We cannot add this item to your shopping cart","We cannot add this item to your shopping Basket"
"%1 was updated in your shopping cart.","%1 was updated in your shopping Basket."
"We cannot update the shopping cart.","We cannot update the shopping Basket."
"Display number of items in cart","Display number of items in Basket"
"Update Shopping Cart","Update Shopping Basket"
"Clear Shopping Cart","Clear Shopping Basket"
"Update Cart","Update Basket"
"Items in Cart","Items in Basket"
"You have no items in your shopping cart.","You have no items in your shopping Basket."
"Cart Subtotal","Basket Subtotal"
"View cart","View Basket"
"Edit Your Cart","Edit Your Basket"
"After Adding a Product Redirect to Shopping Cart","After Adding a Product Redirect to Shopping Basket"
"My Cart Link","My Basket Link"
"Display Cart Summary","Display Basket Summary"
"Shopping Cart Sidebar","Shopping Basket Sidebar"
"Display Shopping Cart Sidebar","Display Shopping Basket Sidebar"

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>atharna</vendor>
    <package>en_us</package>
</language>

regisration.php

<?php

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

Any ideas as to what I'm doing wrong?

4
  • Tried to delete pub/static/frontend folder and run the static content deploy again? Aug 2 '16 at 14:47
  • No that didn't work
    – Mark
    Aug 2 '16 at 15:04
  • You should update the full path of these files. Aug 2 '16 at 16:09
  • How do you mean?
    – Mark
    Aug 2 '16 at 16:20
2

This answer may not same as your code but I have tried as added below and working fine.

magento2\app\code\Vendor\Module\registration.php

<?php

\Magento\Framework\Component\ComponentRegistrar::register(
    \Magento\Framework\Component\ComponentRegistrar::MODULE,
    'Vendor_Module',
    __DIR__
);

magento2\app\code\Vendor\Module\etc\module.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd">
    <module name="Vendor_Module" setup_version="1.0.0" schema_version="1.0.0">
    </module>
</config>

magento2\app\code\Vendor\Module\i18n\en_US.csv

"Add to Cart","Add to Basket"

Run php magento/bin setup:upgrade and remove the cache.

enter image description here

Hope this help.

2

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.