Translates

How to say it in other languages, and what words mean

Spanish

How to Translate CMS Pages in Magento 2

· 6 min read · Spanish

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

Translating CMS pages in Magento 2 lets you serve the same content (like About Us, Contact, or Homepage) in multiple languages, which is essential for stores targeting international customers. This guide covers two methods: using the built-in inline translation tool for quick manual edits, and creating language-specific CMS pages that appear based on the store view. You'll need Magento Admin access with permissions to edit CMS pages and manage store views, plus a backup of your database before making changes.

What You'll Need

  • Magento 2 Admin panel credentials (with CMS and Store configuration permissions)
  • Access to your Magento file system (via SSH or FTP) if using custom translation files
  • A list of the languages you want to support (e.g., English, Spanish, French)
  • Backup of your database and files (recommended before any changes)

Step-by-Step

  1. Set up multiple store views. Go to Stores → All Stores. Create a new store view for each language (e.g., Spanish, French). Ensure each store view is assigned to the same website and store. Note the store view code (e.g., 'es', 'fr') – you'll use it later.
  2. Enable inline translation (optional but helpful). Go to Stores → Configuration → Advanced → Developer → Translate Inline. Set 'Enabled for Storefront' to 'Yes' for the specific store view you're working on. Save config and clear cache. This allows you to click directly on text on the frontend to translate it.
  3. Method 1: Use inline translation for existing CMS pages. Navigate to the frontend page you want to translate (e.g., your About Us page) while logged into Admin. Ensure you're viewing the correct store view (switch via the store switcher in the top admin bar). Click on the text you want to translate – a pencil icon appears. Click it, enter the translation, and save. Repeat for each text block.
  4. Method 2: Create a language-specific CMS page. Go to Content → Pages. Click 'Add New Page'. Fill in the page title and URL key (e.g., 'about-us-es'). In the 'Store View' field (left column), select the specific store view (e.g., Spanish) – this makes the page appear only on that store view. Enter the translated content in the content area. Save.
  5. Assign the translated page to the correct store view. If you created a new page, ensure it's assigned to the correct store view by checking the 'Store View' field. If you used an existing page, you can also duplicate it: go to Content → Pages, select the page, click 'Duplicate', then change the store view and content.
  6. Link the translated page to your navigation. To make the translated page accessible, add it to your menu. Go to Content → Elements → Menus (or your theme's menu settings). Add a menu item pointing to the translated page's URL, and set its visibility to the appropriate store view.
  7. Test the translation. Switch to the translated store view on the frontend (usually via a language switcher or URL suffix). Verify that the correct page appears, with the correct content and URL.
  8. Disable inline translation once done. Go back to Stores → Configuration → Advanced → Developer → Translate Inline and set 'Enabled for Storefront' to 'No' for all store views. Clear cache again.

Common Mistakes

  • Forgetting to assign the page to a specific store view. If you don't set the store view, the page appears on all store views, causing duplicate content or wrong language.
  • Using inline translation on the default store view only. Inline translation works per store view; you must switch to the target store view before translating.
  • Not clearing cache after changes. Magento caches pages aggressively; without cache clearing, you may see old content.
  • Creating a new page but not adding it to navigation. The translated page exists but is unreachable from the frontend.
  • Mixing up URL keys. If you use the same URL key for different store views, Magento may show the wrong page. Use unique URL keys per language (e.g., 'about-us' and 'about-us-es').

Tips

  • Use language-specific URL keys. This helps SEO and avoids confusion. For example, 'about-us' for English, 'acerca-de' for Spanish.
  • Leverage the 'Store View' column in the Pages grid. You can see at a glance which pages are assigned to which store view.
  • For large content, consider using translation files. Instead of inline translation, you can create a CSV file with translations and place it in app/i18n/ folder. This is more efficient for bulk translations but requires technical knowledge.
  • Always test on a staging environment first. Inline translation can accidentally modify the wrong store view if you're not careful.
  • Use the 'Preview' button in the CMS page editor to see how the page looks before saving.

Troubleshooting

  • Translation doesn't appear on the frontend. Check that you're viewing the correct store view (use the store switcher). Clear cache: System → Cache Management → flush all caches. Also ensure inline translation is enabled for that store view.
  • The translated page shows the default language content. This usually means the page is not assigned to the correct store view. Edit the page, check the 'Store View' field, and set it to the desired store view. Also verify that the page URL is unique.
  • Inline translation edits are not saving. Make sure you have proper permissions (Admin role with 'Content' and 'Store' access). Also, try clearing the cache and reloading the page.
  • Language switcher doesn't appear on the frontend. You need to enable the language switcher in your theme. Go to Stores → Configuration → General → Currency Setup → Currency Switcher (or check your theme's header settings). Some themes require manual setup.
  • Duplicate content issues. If you have multiple store views with the same URL key, search engines may penalize you. Use canonical tags or ensure each store view has unique content and URLs.

Frequently Asked Questions

Can I translate CMS pages without creating new pages?

Yes, you can use the inline translation tool to translate existing pages per store view. However, this method translates only the text you click, and it's not ideal for large content changes.

Do I need to set up multiple websites or just store views?

Just store views are sufficient for language translations. Multiple websites are typically used for different domains or customer groups.

Will the translated page have the same URL?

No, each store view can have its own URL key. You can set a different URL key for each language to avoid conflicts.

Can I use a translation extension instead?

Yes, there are extensions like 'Language Pack' or 'Store View Language' that automate translation, but they often require additional configuration and may not be free.

How do I translate the navigation menu items?

Menu items are usually created in Content → Elements → Menus. You can create separate menu items for each store view, or use inline translation on the menu labels.

What if I have a custom theme that doesn't support store view switching?

Most themes support store views, but if not, you may need to edit the theme's template files to add a language switcher. Consult your theme's documentation.