Saturday, 15 June 2013

php - Translating texts, that appear only in one language -


I have a double language (English and Polish) application that is written in Yii 1.x. The base language is English ( sourceLangage ) and the current language ( language ) is controlled by the user.

How should I translate Yii:: T , string, which is not used in English but should be visible in Polish? I Yii: t ('app', ''); , not correct

I use it as something like" full paragraph "in English Not classified wire "which are relevant only in one language or another; For example, you may need an additional explanatory paragraph for a concept, which is" foreign "in a culture, but the other Is natural in, or you have some legal phrasing in a country It may need to be done, but no one else.In these cases, it is not actually a "translation", but there is conditional content, such as a if statement based on the current language The natural way, or the equivalent equivalent (such as "legal. $ Lang.html" .).

A typical date format , in comments The specific example you mentioned is just a classical case of localization, of which Regular translation functions will work properly:

resonance date (Yii: T ('DFY'));

This date format string < Code> DFY in Polish d FY \ r. may need to be localized. Note that you should be able to localize date not if possible, you should use the class, and generally you want to type "type" of date formats Constants, such as IntlDateFormatter :: MEDIUM (January 12, 1952), IntlDateFormatter :: SHORT (12/13/52) etc. Otherwise, locale is capable of formatting a space based on hooks and dates in the system. I do not know how to tie specifically in Yii either.


No comments:

Post a Comment