Articles tagged with "i18n"X
Displaying 11-20 of 27 result(s).

Simple example for language translation

Created 3 years ago by RKAHow-tos2 comments – viewed 20,733 times – ( +1 ) – version 1.1
Language translation is a common requirement in multi lingual sites. In Yii, we can translate using message and view translation.
tags: yii, i18n

Multilanguage and SEO friendly

Created 3 years ago by InterboyHow-tos1 comment – viewed 20,821 times – ( +5 ) – version 1.1
In your application configuration (protected/config/main.php), set the sourceLanguage parameter to English:

How to provide a fallback or mapping for translation messages?

Created 3 years ago by schmunkHow-tos1 comment – viewed 5,800 times – ( +5 ) – version 1.1
Sometimes you want to use exisiting translations for locales, which do not directly match. An example would be a website targeting Germany (de_de), Austria (de_at) and Switzerland (de_ch, fr_ch, it_ch). Although you may have exisiting translations for German (de), French (fr) and Italian (it), there are problems using it directly.

Entire Messages into javascript object

Created 4 years ago by markuxHow-tos0 comments – viewed 6,583 times – ( +2 ) – version 1.1
I needed all messages with their translation into javascript. This is my solution:

Custom Number Formatting or Decimal Separators and i18n

Created 4 years ago by c@cbaTutorials8 comments – viewed 54,807 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...

Using SQLite and CDbMessageSource as a module

Created 4 years ago by pheadeauxHow-tos5 comments – viewed 14,784 times – ( +5 ) – version 1.1
There are scenarios when you work with DVCS (like Mercurial or Git) and CDbMessageSource. To my experience keeping the development database and production database in sync can be very time consuming. Plus, when working in a team, you never know when the database was updated.

How to extend CFormatter, add i18n support to booleanFormat and use it in CDetailView

Created 5 years ago by c@cbaHow-tos3 comments – viewed 12,583 times – ( +9 ) – version 1.1
As you know, the CDetailView widget displays details of a single model. If no formatting is specified, boolean values that are stored in the database as 0 and 1, are represented in the detail view as 0 and 1. If formatted as boolean, they are represented as 'No' and 'Yes'. We want to add i18n support, so that Yes and No appear in the current language.

How to obtain a grammatically correct translation of the model name in giix-generated view files

Created 5 years ago by c@cbaHow-tos0 comments – viewed 11,568 times – ( +4 ) – version 1.1
The giix code generator has out of the box i18n support for model names and attribute labels (besides other cool features > check it out!) . But I want to factor in not only the plural form, but also the grammatical cases (especially the accusative) while translating 'Manage Objects', 'Create Object', 'Edit Object' etc.

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

Created 5 years ago by c@cbaTutorials37 comments – viewed 58,152 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 in english, and 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.

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

Created 5 years ago by c@cbaTutorials10 comments – viewed 35,882 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.