1

I want to translate Magento 2 maintenance page as per country code

Like :-

magento2/it (In the Italian language)

magento2/de (In German)

I tried using csv but it doesn't work even using __('echo the content')

2
  • If you have multi websites then you can set the language for each website sepretly. Commented Dec 20, 2021 at 10:21
  • @DhirenVasoya how I can do that for the maintenance page can you please elaborate Commented Dec 20, 2021 at 11:32

1 Answer 1

1

By default, Magento doesn't support translation out-of-box for error pages and requires some customizations to allow for such features. So technically there is no proper way to do such.

Since the full stack is NOT initialized during error generation, normal translation functionality $this->__('foobar'; won't work in the templates. https://magento.stackexchange.com/a/89316/101754

Found another way for translated maintenance page:

  1. In your .htaccess add a rewrite rule that appends a skin parameter to your URL. Eg.

RewriteCond %{HTTP_HOST} ^french.example.com$ RewriteCond %{DOCUMENT_ROOT}/var/.maintenance.flag -f RewriteCond %{QUERY_STRING} !(^|&)skin=french(&|$) [NC] RewriteRule ^ %{REQUEST_URI}?skin=french[L]

  1. Copy pub/errors/default to pub/errors/french

  2. Change/translate template files to your needs

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.