Magento – Multistore Maintenance Mode Magento 2

magento2.2maintenance

We currently have a multistore Magento 2 set up, we have a custom maintenance page set up using /pub/errors/default/503.phtml, this shows fine when the sites go into maintenance mode, we however want to show a translated message on each page rather than it just being in English. Is this possible?

Best Answer

Untested, just quick code check ... and it seems it works the same way as in Magento 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.

From Translate Maintenance mode per website in multiwebsite-multidomain setup

Maybe you try to adopt the ideas from there ...

Edit:

Magento uses maintenance mode to disable bootstrapping; for example, while you’re maintaining, upgrading, or reconfiguring your site.

https://devdocs.magento.com/guides/v2.2/install-gde/install/cli/install-cli-subcommands-maint.html

Soo its not possible oob ..


Update:

Found another way for translated maintenance page:

  1. In you .htaccess add an 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]
    
  2. Copy pub/errors/default to pub/errors/french

  3. Change/translate template files to your needs
Related Topic