I18N

Hi Yii Dev Team,

Will Yii 2.0 have an way to change messages for the sourceLanguage without having to modify the source code and consequently all translation keys?

Something as mentioned on this wiki article?

How to translate and do the translations the easy way

And what about dates and numbers validators, they will recognize current locale format?

Thank you

Generally there should be no need to use non-English source language. I think it’s better not to introduce artificial message IDs layer since it complicates both code and translation process.

OK, thank you samdark.

And what about dates and numbers validators based on target language formats?

"artificial messge ID layer"

Could you explain more what you mean by that?

andredelorme

Ideally they should.

SapporoGuy

I’ve mean same as in the article linked in the first post. Using non-existing language code as source and calls like




echo Yii::t('app', 'there.is.an.error');



It will require English at least translation file.

This might be true for small or middle sized apps. But imagine you have translated and published the app in all major european languages (should be around 7, I guess). If you need to update the source language and all translated strings it’s fine. But if you have to update the source language but none of the translations(misspelled, grammer fail, region specific, language based offer, etc…) you have to touch every file containing translations. This might be rare, but it takes a lot of time.

I think it should be an option to use faked keys or the real source language. A user should use what ever suits him best.

Have both options is a great approach.

I agree with the use case of the fake source keys. I have in my projects at the moment about 10% of the text translated as a dynamic string passed to Yii::t() - I had to modify the "yiic message" so it does not delete or mark with @@ "removed" translation. Some sort of combined solution would meet all use-cases out there.

They can use just two different methods, say Yii::t() for regular translation and Yii::tk() for translating keyword-based texts.

Anyway there is reason to think this through and think of a better system, except the case of strings written in the source code.

Translation takes time and money.

I want to save both :)

I would love a dual call method:

A.) call all standard phrases/verbs

B.) call translation for current page

This would allow group A to be heavily cached since it will hardly change. Group B is more dynamic since it depends on the nature of the page

Group a could also be tuned by the community and offered as part of the distro like the demos. This will allow to be multilingual on a limited scale from the start.

Group B is user specific so not that different as now.

I’m a big fan of psuedo_keys in the source, especially if a dev has offered their hardwork for others to use. So even if I can’t read the diocumentation I can still benefit from the app.

Also, it reduces redundant translations which save me money and time.

Here is an example:

Edit entry

Edit name

Edit file

Edit page

I’d just round it down to: text_edit >> “edit”

Log into our site

Log in to edit

Log in

text_login >> "log in"

Group A does require effort but uniformity, multiple languages, and a base practice really makes this appealing.

I’d like to re-open the debate on this topic.

I like Yii’s advanced i18n features with the only exception being the lack of fake source keys.

There are several use cases where this feature comes in handy:

[list=1]

[*]Homonymums and their different variants in other languages. You have to keep in mind that while there is a single word "know" in english, my language alone has several translations with contextually different meanings.

[*]Sometimes english is not the native language of the developers and they might not know exactly what is the text’s meaning and why is it where it is in the code, also you have to keep in mind that contrary to the best practices a lot of people use other language than english as their source language which makes it complicated in the moment when people of other nationality are introduced into the development process and there might be a need for switching the source language which is not an easy task to do once you have thousands of messages. The existence of fake keys from the beginning which have logical structure would prevent this problem.

[/list]

Overall I don’t see a reason why not have the option to use artificial language as a source language instead of english.