Your SlideShare is downloading. ×
0
Dutch PHP Conference 2011
Martin de Keijzer
Let’s take over the world
with Zend Framework
Monday, 23 May 2011
Introduction
2
Monday, 23 May 2011
Introduction
Martin de Keijzer
Software engineer at Ibuildings
Board member of PHPBenelux
PHP 5 Zend Certified Engineer
Tw...
DISCLAIMER
DISCLAIMER: ALL EXAMPLE CODE
IS WRITTEN IN THE CONTROLLER BY
EXAMPLE! USE MODELS!!!!
4
Monday, 23 May 2011
Monday, 23 May 2011
The case
6
What do we need to take over the
world?
Monday, 23 May 2011
The case
✓Location (Country and region)
✓Language
✓Date and time
✓Currency
✓Measuring
7
Monday, 23 May 2011
“Location! Location! Location!”
Quote from Achmed (2009)
8
Monday, 23 May 2011
Zend Locale
Monday, 23 May 2011
A locale defines a country (territory) and a language to
bind the various localized information to it.
Zend Locale
10
Mond...
Zend Locale
nl_NL
de_BE
fr_BE
nl_BE
11
Monday, 23 May 2011
CLDR
Common Locale Data Repository
http://cldr.unicode.org
Zend Locale
12
Monday, 23 May 2011
Zend Locale
13
Monday, 23 May 2011
Zend Locale
The current locale is is: nl
The browser's locale is is: nl
The environment's locale is is: de_DE
The set loca...
Zend Locale
15
Monday, 23 May 2011
Zend Locale
16
Monday, 23 May 2011
Zend Locale
17
In FR people speak fr
Monday, 23 May 2011
Zend Locale
18
In FR people speak fr.
In France people speak French.
Monday, 23 May 2011
Zend Locale
19
Monday, 23 May 2011
Zend Locale
20
Monday, 23 May 2011
Zend Locale
array(6) {
["yes"]=>
string(2) "ja"
["no"]=>
string(3) "nee"
}
21
Monday, 23 May 2011
Zend Locale
["yesarray"]=>
array(2) {
[0]=>string(2) "ja"
[1]=>string(1) "j"
}
["noarray"]=>
array(2) {
[0]=>string(3) "ne...
Zend Locale
["yesexpr"]=>
string(20) "^([jJ][aA]?)|([jJ]?)"
["noexpr"]=>
string(26) "^([nN]([eE][eE])?)|
([nN]?)"
23
Monda...
Zend Locale
A list of supported locales:
http://framework.zend.com/manual/
en/zend.locale.appendix.html
24
Monday, 23 May ...
Zend Locale
Utilized by:
Zend_Controller_Router
Zend_Currency
Zend_Date
Zend_Filter
Zend_Measure
Zend_Service_Technorati
Z...
Speaking the language
Zend_Translate
26
Monday, 23 May 2011
Zend Translate
Operates using adapters:
Array
Csv
Gettext
Tbx
Tmx
Qt
Xliff
Xmltm
27
Monday, 23 May 2011
Zend Translate
28
Monday, 23 May 2011
Zend Translate
29
Monday, 23 May 2011
Zend Translate
30
nl.php
fr.php
Monday, 23 May 2011
Zend Translate
31
my-view.phtml
Monday, 23 May 2011
Zend Locale
32
Monday, 23 May 2011
Zend Locale
Quick hint: Google uses locales too!
Zend Framework is your gateway to more power!
33
Monday, 23 May 2011
Monday, 23 May 2011
Do not get lost in time
Zend_Date
35
Monday, 23 May 2011
Zend Date
The date is May 2, 2011 9:13:41 PM.
The date is 2 mei 2011 21:13:41.
36
Monday, 23 May 2011
Zend Timesync
37
2 mai 2011 21:25:09
Monday, 23 May 2011
Zend_Locale revisited
38
You can use Zend_Locale_Format to override
date and number formatting.
I never had any use for it...
Show me the money!
Zend_Currency
39
Monday, 23 May 2011
Zend Currency
40
Monday, 23 May 2011
Zend Currency
In the Netherlands you pay with Euro (€).
And in the UK you pay with British Pound
Sterling (£).
41
Monday, ...
Zend Currency
42
Monday, 23 May 2011
Zend Currency
43
Please hand me 10.00
US Dollar for food and
shelter.
Monday, 23 May 2011
Zend Currency
44
Got lost in locales?
getCurrencyList()
getRegionList()
getLocale()
Monday, 23 May 2011
Never trust a user!
Zend_Validate
45
Monday, 23 May 2011
Zend Validate
46
Monday, 23 May 2011
Zend Validate
47
Monday, 23 May 2011
Measures please?
Zend_Measure
48
Monday, 23 May 2011
Zend Measure
49
Monday, 23 May 2011
Zend Measure
50
A Big Mac’s weight is 200,05 g in the Netherlands.
In the USA this would be
0.441034755500847600236309 lbs...
Zend Measure
Zend_Measure doesn’t utilize locales to give you
the correct units, but only the correct number
formats.
51
M...
Conclusion
52
Monday, 23 May 2011
Image sources
Achmed http://barenakedislam.wordpress.com/2011/01/27/sweden-muslim-offended-by-ahmed-the-dead-terrorist-dem...
Questions ?
54
Monday, 23 May 2011
Thank you!
Contact details:
Twitter: @Martin1982
Blog: http://www.martindekeijzer.nl
Please give feedback on Joind.in!
htt...
Upcoming SlideShare
Loading in...5
×

Let's take over the world with Zend Framework

432

Published on

Many people use Zend Framework for it's MVC implementation, but it has a lot of hidden gems. Internationalization (i18n) is one of them. We will look how you can create an application that will have the right languages, currencies, dates and times all based on the location of the visiting user. This session will take away a lot of headaches in international projects and will improve the quality in overall.

Published in: Technology, Travel
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
432
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
4
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Transcript of "Let's take over the world with Zend Framework"

  1. 1. Dutch PHP Conference 2011 Martin de Keijzer Let’s take over the world with Zend Framework Monday, 23 May 2011
  2. 2. Introduction 2 Monday, 23 May 2011
  3. 3. Introduction Martin de Keijzer Software engineer at Ibuildings Board member of PHPBenelux PHP 5 Zend Certified Engineer Twitter: Martin1982 Joind.in: http://joind.in/3253 Blog: www.martindekeijzer.nl 3 Monday, 23 May 2011
  4. 4. DISCLAIMER DISCLAIMER: ALL EXAMPLE CODE IS WRITTEN IN THE CONTROLLER BY EXAMPLE! USE MODELS!!!! 4 Monday, 23 May 2011
  5. 5. Monday, 23 May 2011
  6. 6. The case 6 What do we need to take over the world? Monday, 23 May 2011
  7. 7. The case ✓Location (Country and region) ✓Language ✓Date and time ✓Currency ✓Measuring 7 Monday, 23 May 2011
  8. 8. “Location! Location! Location!” Quote from Achmed (2009) 8 Monday, 23 May 2011
  9. 9. Zend Locale Monday, 23 May 2011
  10. 10. A locale defines a country (territory) and a language to bind the various localized information to it. Zend Locale 10 Monday, 23 May 2011
  11. 11. Zend Locale nl_NL de_BE fr_BE nl_BE 11 Monday, 23 May 2011
  12. 12. CLDR Common Locale Data Repository http://cldr.unicode.org Zend Locale 12 Monday, 23 May 2011
  13. 13. Zend Locale 13 Monday, 23 May 2011
  14. 14. Zend Locale The current locale is is: nl The browser's locale is is: nl The environment's locale is is: de_DE The set locale is is: en_US 14 Monday, 23 May 2011
  15. 15. Zend Locale 15 Monday, 23 May 2011
  16. 16. Zend Locale 16 Monday, 23 May 2011
  17. 17. Zend Locale 17 In FR people speak fr Monday, 23 May 2011
  18. 18. Zend Locale 18 In FR people speak fr. In France people speak French. Monday, 23 May 2011
  19. 19. Zend Locale 19 Monday, 23 May 2011
  20. 20. Zend Locale 20 Monday, 23 May 2011
  21. 21. Zend Locale array(6) { ["yes"]=> string(2) "ja" ["no"]=> string(3) "nee" } 21 Monday, 23 May 2011
  22. 22. Zend Locale ["yesarray"]=> array(2) { [0]=>string(2) "ja" [1]=>string(1) "j" } ["noarray"]=> array(2) { [0]=>string(3) "nee" [1]=>string(1) "n" } 22 Monday, 23 May 2011
  23. 23. Zend Locale ["yesexpr"]=> string(20) "^([jJ][aA]?)|([jJ]?)" ["noexpr"]=> string(26) "^([nN]([eE][eE])?)| ([nN]?)" 23 Monday, 23 May 2011
  24. 24. Zend Locale A list of supported locales: http://framework.zend.com/manual/ en/zend.locale.appendix.html 24 Monday, 23 May 2011
  25. 25. Zend Locale Utilized by: Zend_Controller_Router Zend_Currency Zend_Date Zend_Filter Zend_Measure Zend_Service_Technorati Zend_Timesync Zend_Translate Zend_Validate 25 Monday, 23 May 2011
  26. 26. Speaking the language Zend_Translate 26 Monday, 23 May 2011
  27. 27. Zend Translate Operates using adapters: Array Csv Gettext Tbx Tmx Qt Xliff Xmltm 27 Monday, 23 May 2011
  28. 28. Zend Translate 28 Monday, 23 May 2011
  29. 29. Zend Translate 29 Monday, 23 May 2011
  30. 30. Zend Translate 30 nl.php fr.php Monday, 23 May 2011
  31. 31. Zend Translate 31 my-view.phtml Monday, 23 May 2011
  32. 32. Zend Locale 32 Monday, 23 May 2011
  33. 33. Zend Locale Quick hint: Google uses locales too! Zend Framework is your gateway to more power! 33 Monday, 23 May 2011
  34. 34. Monday, 23 May 2011
  35. 35. Do not get lost in time Zend_Date 35 Monday, 23 May 2011
  36. 36. Zend Date The date is May 2, 2011 9:13:41 PM. The date is 2 mei 2011 21:13:41. 36 Monday, 23 May 2011
  37. 37. Zend Timesync 37 2 mai 2011 21:25:09 Monday, 23 May 2011
  38. 38. Zend_Locale revisited 38 You can use Zend_Locale_Format to override date and number formatting. I never had any use for it though..... Monday, 23 May 2011
  39. 39. Show me the money! Zend_Currency 39 Monday, 23 May 2011
  40. 40. Zend Currency 40 Monday, 23 May 2011
  41. 41. Zend Currency In the Netherlands you pay with Euro (€). And in the UK you pay with British Pound Sterling (£). 41 Monday, 23 May 2011
  42. 42. Zend Currency 42 Monday, 23 May 2011
  43. 43. Zend Currency 43 Please hand me 10.00 US Dollar for food and shelter. Monday, 23 May 2011
  44. 44. Zend Currency 44 Got lost in locales? getCurrencyList() getRegionList() getLocale() Monday, 23 May 2011
  45. 45. Never trust a user! Zend_Validate 45 Monday, 23 May 2011
  46. 46. Zend Validate 46 Monday, 23 May 2011
  47. 47. Zend Validate 47 Monday, 23 May 2011
  48. 48. Measures please? Zend_Measure 48 Monday, 23 May 2011
  49. 49. Zend Measure 49 Monday, 23 May 2011
  50. 50. Zend Measure 50 A Big Mac’s weight is 200,05 g in the Netherlands. In the USA this would be 0.441034755500847600236309 lbs Monday, 23 May 2011
  51. 51. Zend Measure Zend_Measure doesn’t utilize locales to give you the correct units, but only the correct number formats. 51 Monday, 23 May 2011
  52. 52. Conclusion 52 Monday, 23 May 2011
  53. 53. Image sources Achmed http://barenakedislam.wordpress.com/2011/01/27/sweden-muslim-offended-by-ahmed-the-dead-terrorist-demands-compensation-for-mental- anguish/jeff-dunham_achmed/ Clocks http://blogs.manageengine.com/image/501000000062207/timezones.jpg Cat http://icanhascheezburger.com Pinky & the brain http://blogg.visir.is/purplemagic/category/truarbrogð/ Zend Framework logo http://www.myskills.be/ Sneaking in: http://fakeposters.com 53 Monday, 23 May 2011
  54. 54. Questions ? 54 Monday, 23 May 2011
  55. 55. Thank you! Contact details: Twitter: @Martin1982 Blog: http://www.martindekeijzer.nl Please give feedback on Joind.in! http://joind.in/3253 Monday, 23 May 2011
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×