PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Friday, April 22, 2022

[FIXED] Why does CakePHP formhelper not translate months?

 April 22, 2022     cakephp, cakephp-2.3, formhelper     No comments   

Issue

I would like to see a Dutch translation of the CakePHP 2.3.7 formhelper months. See this link: http://dev4.west-dyke.com/verhuur/reserveren.

However I can't seem to get it working. I also saw another post about this problem, but it still didn't solve the problem.

I created a folder named app/Locale/nl_NL/LC_MESSAGES/cake.po. The PO file was generated with poedit from cake.pot in the app/Locale directory.

I added these lines to cake.po:

msgid "January"
msgstr "Januari"

msgid "February"
msgstr "Februari"

msgid "March"
msgstr "Maart"

msgid "April"
msgstr "April"

msgid "May"
msgstr "Mei"

msgid "June"
msgstr "Juni"

msgid "July"
msgstr "Juli"

msgid "August"
msgstr "Augustus"

msgid "September"
msgstr "September"

msgid "October"
msgstr "Oktober"

msgid "November"
msgstr "November"

msgid "December"
msgstr "December"

I added the following line to the bottom of my bootstrap.php file:

Configure::write('Config.language','nl_NL');

Does anybody have an idea of what's going wrong?


Solution

Allright I fixed it, I did the following to get multi language and a Dutch translation of the CakePHP formhelper months working:

1 - I created a folder named app/Locale/nl_NL/LC_MESSAGES

2 - I ran ./Console/cake i18n extract through the console

3 - I added the following lines to cake.pot:

msgid "January"
msgstr "Januari"

msgid "February"
msgstr "Februari"

msgid "March"
msgstr "Maart"

msgid "April"
msgstr "April"

msgid "May"
msgstr "Mei"

msgid "June"
msgstr "Juni"

msgid "July"
msgstr "Juli"

msgid "August"
msgstr "Augustus"

msgid "September"
msgstr "September"

msgid "October"
msgstr "Oktober"

msgid "November"
msgstr "November"

msgid "December"
msgstr "December"

4 - I used poEdit to create .po (and .mo) files from default.pot and cake.pot. I placed the .po (and .mo) files inside the earlier created folder.

5 - I placed the following line inside bootstrap.php:

Configure::write('Config.language','nl_NL');


Answered By - Hans
Answer Checked By - Willingham (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing