Aug 13, 2019

Troubleshooting Cakephp 3 showing "Blank page" (Clue: internationalisation (i18n))

Understanding i18n

To implement multiple languages in your webpage, you need internationalisation (or i18n, start with an alphabet "i", 18 alphabet in the middle and end with an "n").

If you have came across this feature, you'll know you need your static content written in the following format:

echo __('Text to be translated');


And the "Text to be translated" will appear in your Locale folder's in "po" formatted file.

Potential cause of the "Blank page"

Overview of the findings, the "blank" page appears in:

  • complete blank screen and show nothing, 
  • browser is showing correct code in the HTML page source (without HTML code from chosen layout)
  • page goes blank without any warning/error messages

Things to check for the issue

  • is the "__()" written correctly? Make sure it's 2 underscores + text in the bracket.
  • Search your source code and find if there is any mistakenly written single underscore "_()" i18n syntax
  • be warned, you won't get any error message from single underscore i18n syntax "_()" mistake


References:
CakePHP 3 - Internationalization & Localization
CakePHP 3 - Global function __()

No comments:

Post a Comment

Hey, thank you for spending time leaving some thoughts, that would be really helpful as encouragement for us to write more quality articles! Thank you!