-
- 61 Posts
I am building a site in Spanish, and I am thinking that the best way to make sure all my dates, times, etc. get rendered correctly is to have a plugin that listens for an event such as OnWebPagePreRender (or whatever that event is called) and then uses PHP’s setlocale() function to switch the locale setting to Spanish.
My question is, if I want to make this more configurable so that it could be used to set the locale to any desired setting, how would I go about this? I see that you can set up some sort of configuration string for a plugin. What’s that all about? Would that help me do what I want? Also could I set it up some how so that it set the locale to Spanish at the beginning of the page rendering process and then set it back to English after the page is rendered?
Or is there a better way to do this than using a plugin? I can’t find any documentation on how plugins work except for a few examples with no explanation.
Dave
-
- 7,075 Posts
Guillaume has worked a lot on this issues, I suggest you read this :
Add SetLocale to language files
and this
[Snippet] FormatDate
Hope it helps
.: COO - Commerce Guys - Community Driven Innovation :.
MODx est l'outil id
-
- 711 Posts
FormatDate permits to format date with the localization used. To modify your setting you can see
Add SetLocale to language files. If spanish settings is not avalaibled a solution is to replace each english word by spanish word.
If you can’t modify local setting you can use the plugin
WordsReplace to replace english words by spanish words.
Sorry for my english. I'm french... My dictionary is near me, but it's only a dictionary !