Internationalization of Cakephp and use of poEdit
Cakephp’s very powerful i18n function is used to achieve localization and internationalization. It uses language configuration files to enable programs to adapt to changes and be localized. Implement this by creating a new locale/chi/LC_MESSAGES/default.po file and specifying the language option as "chi". This article talks about how to implement this localization process. Of course, poetry in this article is not necessary, but it can make work more efficient.
1. About i18n and L10n
In fact, I was confused when I saw these two things for the first time, but after a search on Baidu, I came to the conclusion that no matter how many n, the ultimate goal Just implement program localization. To put it bluntly, it consists of many language configuration files. Anyway, this is how I understand it. You can also take a look at http://baike.baidu.com/view/372835.htm There are very detailed instructions here.
2. How to implement localization in Cakephp
So far, there are 2 configuration methods.
2.1 Method 1
Use configure::write in config/core.php to specify the language file.
Configure::write('Config.language',"chi");
2.2 Method 2
Official description: http://book.cakephp.org/view/162/Localizing-Your-Application
It seems very complicated Say oh.
App::import('Core', 'l10n'); classTestsController extendsAppController{ $name="Tests"; functiontest_function(){ $this->L10n->newL10n(); $this->L10n- >get("chi"); ..... } }2.3 What you need to do after making the above settings changes:
Of course, after making the above changes, you also need to modify the corresponding ctp file, etc.
All directly Output a string, where there is no return value like this:
__("english");
Output the string indirectly, where there is a return:
__("english",true);
There is also input required Add a label to make it appear in Chinese.
__("english");echo $form->input('name',array('label'=>__('name',true))));
2.4 The most important step
Just edit this file, locale/chi/LC_MESSAGES/default.po. The chi in the middle is the flag of the language file. The format of this file is also very simple, just a simple repetition of
msgid "Chinese"
msgstr "中文"
will do.
3. Use poedit
Using poedit is not necessary, but it can make the work much easier. The official website is: http://www.poedit.net/
Its main function is to make editing language configuration files more convenient and faster. Below are some simple screenshots and instructions for using poetry.
3.1 You need to select the interface language for the first time. Please indicate the source for reprinting: Internationalization of Cakephp and the use of poEdit
The above is the content of the internationalization of Cakephp and the use of poEdit. For more related content, please pay attention to the PHP Chinese website (www .php.cn)!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics











In this chapter, we will understand the Environment Variables, General Configuration, Database Configuration and Email Configuration in CakePHP.

Working with database in CakePHP is very easy. We will understand the CRUD (Create, Read, Update, Delete) operations in this chapter.

Validator can be created by adding the following two lines in the controller.

CakePHP is a powerful PHP framework that provides developers with many useful tools and features. One of them is pagination, which helps us divide large amounts of data into several pages, making browsing and manipulation easier. By default, CakePHP provides some basic pagination methods, but sometimes you may need to create some custom pagination methods. This article will show you how to create custom pagination in CakePHP. Step 1: Create a custom pagination class First, we need to create a custom pagination class. this

CakePHP is an open source PHPMVC framework which is widely used in web application development. CakePHP has many features and tools, including a powerful database query builder for interactive performance databases. This query builder allows you to execute SQL queries using object-oriented syntax without having to write cumbersome SQL statements. This article will introduce how to use the database query builder in CakePHP. Establishing a database connection Before using the database query builder, you first need to create a database connection in Ca

Logging in CakePHP is a very easy task. You just have to use one function. You can log errors, exceptions, user activities, action taken by users, for any background process like cronjob. Logging data in CakePHP is easy. The log() function is provide

CakePHP is an open source web application framework built on the PHP language that simplifies the development process of web applications. In CakePHP, processing file uploads is a common requirement. Whether it is uploading avatars, pictures or documents, the corresponding functions need to be implemented in the program. This article will introduce how to handle file uploads in CakePHP and some precautions. Processing uploaded files in Controller In CakePHP, uploaded files are usually processed in Cont

In this chapter, we are going to learn the following topics related to routing ?
