Skip to content

Instantly share code, notes, and snippets.

@pixelistik
Created June 12, 2012 22:22
Show Gist options
  • Save pixelistik/2920493 to your computer and use it in GitHub Desktop.
Save pixelistik/2920493 to your computer and use it in GitHub Desktop.
Date formatting I18n with CakePHP

CakePHP 1.3 can handle nice Date/Time string formatting independently from Locales installed on the host OS.

You need to do some things, as explained in this blogpost

  1. Create a LC_TIME file for the language you want to support, e.g. /app/locale/de_DE/LC_TIME (see also CakePHP book)
  2. From your Linux system, copy everything between LC_TIME and END LC_TIME from /usr/share/i18n/locales/de_DE into your LC_TIME file, plus the first two lines
escape_char  /
comment_char  %
  1. Now activate this language in your app: `Configure::write('Config.language','de_DE');
  2. TimeHelper::i18nFormat() will now observe your language.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment