O'Reilly logo

CakePHP 1.3 Application Development Cookbook by Mariano Iglesias

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Internationalizing controller and view texts

In this recipe, we will learn how to internationalize text that is located in our application views, and have that content ready for translation.

Getting ready

To go through this recipe, we need some data to work with. Create a table named articles with the following SQL statement:

CREATE TABLE `articles`(
`id` INT UNSIGNED AUTO_INCREMENT NOT NULL,
`title` VARCHAR(255) NOT NULL,
`body` TEXT NOT NULL,
`created` DATETIME NOT NULL,
`modified` DATETIME NOT NULL,
PRIMARY KEY(`id`)
);

Now add some sample data to this table with the following statement:

INSERT INTO `articles`(`title`, `body`, `created`, `modified`) VALUES ('First Article', 'Body for first article', NOW(), NOW()), ('Second Article', 'Body for ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required