Wiki

Articles tagged with "i18n", sorted by viewsX
Displaying 1-10 of 26 result(s).

Setting and maintaining the language in Application (i18n)

Created 6 years ago by olafureTutorials12 comments – viewed 90,041 times – ( +23 ) – version 1.1
As seen in this post, Yii doesn't enforce how language is set and maintained within the session.
tags: i18n, translation

How to set up Unicode

Created 6 years ago by MikeHow-tos10 comments – viewed 76,416 times – ( +19 ) – version 1.1
To fix issues with display of special language characters once and for all there's a solution: use Unicode UTF-8 everywhere. If everything is set up to use Unicode, you can use mostly every language in your application.
tags: i18n, unicode

Local time zones and locales

Created 4 years ago by Russell EnglandHow-tos9 comments – viewed 59,096 times – ( +14 / -2 ) – version 1.1
Following on from international dates, I also wanted times in the local timezone and format. This was a little more tricky but I think I've got a solution. This is only really appropriate if you have an international app.

SEO-conform Multilingual URLs + Language Selector Widget (i18n)

Created 3 years ago by c@cbaTutorials36 comments – viewed 49,737 times – ( +32 ) – version 1.1
You have a multilingual application, and you want the URL of a page to be different for different languages, to account for SEO. The URL for the contact page for example should look like http://something.com/en/contact in english, and http://something.com/de/contact in german. This tutorial describes how to make it happen. Note that currently selected language is always a part of the URL, and thus available to the application through $_GET. You don't have to use sessions variables to keep track of the language if you don't want to.

How to customize Yii core messages?

Created 6 years ago by qiangTutorials7 comments – viewed 47,421 times – ( +18 ) – version 1.1
Yii core messages refer to static text strings in the core Yii framework code which are meant to be displayed to end-users (e.g. core exception messages, default validation error messages). Customization of these core messages is needed in two circumstances:

Custom Number Formatting or Decimal Separators and i18n

Created 3 years ago by c@cbaTutorials8 comments – viewed 41,951 times – ( +7 ) – version 1.1
By default, the decimal separator in php (also in mysql) is a dot (.). So when we work with floats in Yii (in calculations, validation, sql statements etc.), the decimal separator has to be a dot. If we want to use for example a comma (,) as the decimal separator, that is if we want to display numbers and enable users to enter numbers with a comma before the decimals, we have to...

Save and Display Date/Time Fields in different formats in Yii2

Created about a year ago by Kartik VHow-tos10 comments – viewed 34,102 times – ( +37 ) – version 2.0
You would find having such a need in most Yii Projects. Your database needs a specific format to store date fields, while you may want to display it in different formats to the users on forms and other views.

Using International Dates

Created 4 years ago by Russell EnglandHow-tos4 comments – viewed 33,073 times – ( +18 ) – version 1.1
I needed British (dd/mm/yyyy) formatted dates throughout my application but found it very difficult to find examples of how to do this - until I found this excellent forum post http://www.yiiframework.com/forum/index.php?/topic/3649-dealing-with-i18n-date-formats/

Manage (Target) Language in Multilingual Applications + A Language Selector Widget (i18n)

Created 3 years ago by c@cbaTutorials10 comments – viewed 31,087 times – ( +15 ) – version 1.1
In case of a multilingual application, one might consider it a reasonable approach to store the preferred language of the user in a session variable, and after that, every time a page is requested, to check this session variable and render the page in the indicated language. This tutorial shows a Yii-way of doing this. We implement an event handler for the onBeginRequest event; as the name of the event suggests, this event handler will be called at the beginning of each request, so its a good place to check whether a language is provided (via post, session or cookie) and set the application language accordingly. We also implement a simple Language-Selector Widget, which can render the language options as ajax-links or as a drop-down list.

I18n subdomains and url-rules

Created 5 years ago by Y!!Tutorials6 comments – viewed 24,884 times – ( +7 ) – version 1.1
This guide is for more or less advanced users. If you just started with Yii or didn't worked with any web-framework before, you may should come back later :-)
tags: i18n, URL