1

I have a Magento 2 shop hosted using a traditional cPanel hosting solution. Performance seems to be stable with the demo data and I'd like to install a language pack.

My problem is that I can only access a file manager, or run very simple commands by creating one-time cron jobs that execute a command ! and I have to manually delete them afterwards.

How can I install a language pack using these restrictions, since I do not believe I have composer installed ?

1

According to your requirements, you can create a translation module yourself manually.

  1. app/i18n/languageName/code_ISO/code_ISO.csv

    Example: for the French language it will be like this: app/i18n/french/fr_FR/fr_FR.csv

    • You put your translation words inside fr_FR.csvlike this :

    "Hello","Bonjour"

    • You can specify the translation for some module like this, example here is a captcha module "Incorrect CAPTCHA","CAPTCHA incorrect",module,Magento_Captcha
  2. app/i18n/languageName/code_ISO/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>code_ISO</code>
        <vendor>languageName</vendor>
        <package>code_iso</package>
    </language>
    

    French language example: app/i18n/french/fr_FR/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>fr_FR</code>
        <vendor>french</vendor>
        <package>fr_fr</package>
    </language>
    
  3. app/i18n/languageName/code_ISO/registration.php

    <?php
        \Magento\Framework\Component\ComponentRegistrar::register(
        \Magento\Framework\Component\ComponentRegistrar::LANGUAGE,
        'languageName_code_iso',
        __DIR__
    );
    

    French language example: app/i18n/french/fr_FR/registration.php

    <?php
        \Magento\Framework\Component\ComponentRegistrar::register(
        \Magento\Framework\Component\ComponentRegistrar::LANGUAGE,
        'french_fr_fr',
        __DIR__
        );
    
  4. Clean your cache, deploy the static-content like this :

    • Delete the contents of pub/static except .htaccess
    • Delete the contents of var/cache
    • Delete the contents of var/view_preprocessed
    • Run this command:
      php bin/magento setup:static-content:deploy -f
  • Ideally I'd like to be able to use one of the community available language packs. How could I use those language packs and adapt them to make it work with your solution? – goncalotomas Mar 4 '18 at 11:09
  • You download the package then you copy the csv language file code_ISO.csv in my module, you can after that customising it. Or you install it directly with composer if you can – PЯINCƏ Mar 4 '18 at 13:01

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.