Prev | Current Page 340 | Next

Rob Allen, Nick Lo, and Steven Brown

"Zend Framework in Action"

com>
Zend Framework in Action (Ch01) Manning Publications Co. 40
Figure 14.1 The text on the German version of Places is translated, but the same view templates are used to ensure that adding
additional languages does not require too much work.
The key steps we will be taking to make Places multi-lingual are:
Change the default router to support a language element.
Create an Action Helper to create the Zend_Translate object and load the correct language file.
Update the controllers and views to translate all text.
We will start by looking at how to make the Front Controller??™s router multi-language aware so that the
user can select a language.
14.3.1 Selecting the language
The first decision that needs to be made is how to determine the user??™s language choice. The easiest
solution is to ask the web browser using Zend_Locale??™s getLanguage() function and then store this into the
session. This has a few problems that need to be considered. Firstly, sessions rely on cookies and so the user
would have to have cookies enabled in order to view the site in another language. Related to this, creating a
session for every user involves overhead that we may not want to bear. The final problem is that search
engines like Google would only see the English version of the site.


Pages:
328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352
remanent Koraliki Accept nowoczesne meble sandomierz