Question

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 ?

Was it helpful?

Solution

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
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top