Magento 2 Translation

Internationalization and localization

The terms are frequently abbreviated to the numeronyms i18n (where 18 stands for the number of letters between the first i and the last n in the word internationalization, a usage coined at DEC in the 1970s or 80s)[3][4] and L10n for localization, due to the length of the words.

 i18n means internationalization

Translation

Magento translates words and phrases when all of the following conditions are met:

  • ddThe Magento code base has the necessary translation dictionaries for a language
  • This language is configured by the store administrator to be used in specified scope (that is, storefront)

The Magento application automatically assembles translation dictionaries located in modules’ i18n directory into a dictionary per language. For example, Brazilian Portuguese (pt_BR) translation dictionaries might be located inmodule and theme directories similar to the following:

app/code/Magento/Checkout/i18n/pt_BR.csv
app/design/frontend/Magento/demo/i18n/pt_BR.csv
Assembling the preceding pt_BR.csv files across all modules and the current theme results in a Portuguese translation of the entire application area (storefront or the Admin).

Magento Security Checklist: How to protect your Magento store?

Every Magento Store owner and developer need to follow some basic steps to increase the store security.

 

1 . Latest Magento –

Use the latest version of Magento to ensure that your installation includes the most recent security enhancements.

If for any reason you cannot upgrade to the latest version, make sure to install all security patches as recommended by Magento. Although Magento issues security patches to fix major issues, new product releases include additional improvements to help secure the site.

https://www.magereport.com/

2 . Unique Admin URL –

Use a unique, custom Admin URL instead of the default “admin” or the often-used “backend,” Although it will not directly protect your site from a determined attacker, it can reduce exposure to scripts that try to break into every Magento site. (Never leave your valuables in plain sight.)

Check with your hosting provider before implementing a custom Admin URL. Some hosting providers require a standard URL to meet firewall protection rules.

3 . Block Access To any Development

Block access to any development, staging, or testing systems. Use IP whitelisting and .htaccess password protection. When compromised, such systems can produce a data leak or be used to attack the production system.

4 . File & Folder Permissions-

Use the correct file permissions. Core Magento and directory files should be set to read only, including app/etc/local.xml files.

5 . Strong Admin Password –

Use a strong password for the Magento Admin. To learn more, see: Creating a strong password.

Take advantage of Magento’s security-related configuration settings for Admin Security, Password Options, and CAPTCHA.

Application Level

1 . Disable development and errors for live site.

2 . change default admin from admin url

3 . Keep patch updated on site and latest version of magento.

Server Level

1 . Keep permission for selected ip’s

2 . set server level firewal

3. set up ssl

How to Optimize Magento ?

1. Enable Flat Catalog

Magento uses the EAV model (entity attribute value) to store customer and product data. Enabling the flat catalog for categories and products merges product data into one table, thereby improving performance by responding to MySQL queries faster. If your eCommerce store has more than 1000 products, this can very beneficial.

2. Image Optimization

As we mentioned in a previous post on lossless image compression, on average 56 percent of a website’s page weight is made up of images. Optimizing your product images can dramatically increase the speed of your pages as this decreases their download times. You can compress them before uploading them using a tool like PhotoShop or there are a number of extensions you can use to auto-optimize them. For Magento version <2 users, the following extensions are available.

3. Concatenate (merge) CSS and Javascript Files

Magento version <2 actually has a built in feature to concatenate (merge) your CSS and Javascript files into one file. This will reduce your total number of HTTP requests and in turn help speed up the loading of your pages.

  1. Navigate to “System” → “Advanced” → “Developer.”
  2. Under “JavaScript Settings” and “CSS Settings” change the dropdown to “Yes” and click on “Save Config.

4. Enable Magento Compilation

Magento has a compilation feature which has been reported to sometimes give up to a 50% performance boost. By default, Magento’s application files are searched in a certain order everytime the page loads, which results in a lot of filesystem reads. The Magento compiler reduces these reads by copying all of these files into a single include directory and also caches ones that are used more frequently.

  1. Navigate to “System” → “Tools” → “Compilation.”
  2. Click on “Run Compilation Process.”

5. Clean Up Magento Database & Logs

By default, Magento keeps logs up to 180 days. This can result in your database growing quite large. You change it to something smaller like two weeks (14 days) to save space.

  1. Navigate to “Stores” → “Configuration” → “Advanced”→ “System” → “Log.”
  2. Under “Save Log, Days” change it to 14 days, or whatever you prefer.
  3. Click on “Save Config.”

You can also manually clean up your database by emptying the log tables.

  1. In phpMyAdmin select all of the log_% tables and select “Empty” from the drop-down box.
  2. Click on “Yes” when it asks you if you really want to TRUNCATE the tables.

6 . Server Level Config and .htaccess Tweaks

The default .>htaccess file included with Magento includes several sections discussing performance. Comment out the following sections and enable them to apply their benefits.

Disable ETags

ETages allow browsers to validate cached page components from visit to visit. While useful, they can hamper websites hosted on server clusters in some cases. Disabling them as follows will often improve performance:

############################################
## If running in cluster environment, uncomment this
## http://developer.yahoo.com/performance/rules.html#etags

    FileETag none

Enable Expires headers

Attention: The following will not function on LiteSpeed servers.

Browsers use Expires headers to define the lifespan of cached page components. While all page components should include Expires headers, static components and images should use far-future Expires headers.

To activate this feature, uncomment the appropriate line and, directly above it, add ExpiresActive On. For example:

############################################
## Add default Expires header
## http://developer.yahoo.com/performance/rules.html#expires

    ExpiresActive On
    ExpiresDefault "access plus 1 year"

Enable output compression

This section discusses how to compress both static content such as text, CSS, JavaScript, and individual HTML files, and dynamic content such as content generated by CMSs like Magento, WordPress, and ExpressionEngine, among others.

Static content

This will activate the Apache mod_deflate module and compress static resources into smaller files before transfer to the browser. To enable, uncomment the appropriate lines as shown below:

############################################
## enable apache served files compression
## http://developer.yahoo.com/performance/rules.html#gzip

    # Insert filter on all content
    SetOutputFilter DEFLATE
    # Insert filter on selected content types only
    AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/javascript 

    # Netscape 4.x has some problems...
    BrowserMatch ^Mozilla/4 gzip-only-text/html

    # Netscape 4.06-4.08 have some more problems
    BrowserMatch ^Mozilla/4\.0[678] no-gzip

    # MSIE masquerades as Netscape, but it is fine
    BrowserMatch \bMSIE !no-gzip !gzip-only-text/html

    # Don't compress images
    SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary

    # Make sure proxies don't deliver the wrong content
    Header append Vary User-Agent env=!dont-vary

Dynamic content

If, however, your site relies on dynamically generated content, instead create a file called .user.ini in your site’s document root folder with the following contents:

zlib.output_compression = on

If you are a Nexcess client, we can make this the default setting for your account upon request.

7 . Caching

ENABLING MEMCACHED FOR MAGENTO 1.9 AND OLDER VERSIONS

To enable memcached for Magento 1.9 and older versions, you need to add some settings to the local.xml file. To do this, follow these steps:

  1. Using your preferred text editor, navigate to the directory where you installed Magento, and then open the app/etc/local.xml file.
  2. Add the following lines just before the closing </global> tag:
    <cache>
        <backend>memcached</backend>
        <memcached>
            <servers>
                <server>
                    <host><![CDATA[127.0.0.1]]></host>
                    <port><![CDATA[11211]]></port>
                    <persistent><![CDATA[1]]></persistent>
                </server>
            </servers>
            <compression><![CDATA[0]]></compression>
            <cache_dir><![CDATA[]]></cache_dir>
            <hashed_directory_level><![CDATA[]]></hashed_directory_level>
            <hashed_directory_umask><![CDATA[]]></hashed_directory_umask>
            <file_name_prefix><![CDATA[]]></file_name_prefix>
        </memcached>
    </cache>

    If these lines are not contained in the <global> section, Magento will not use memcached.

  3. Save your changes to the local.xml file. Memcached is now enabled.