Proposal: Let yiic webapp & crud generate language-specific skeletons using Yii::t()

Hi!

I have recently create the germancrudcommand extension, which generates all strings in german - but obviously this isn’t very efficient cause we wouldn’t want a extension for every language around - and don’t want to build an own yiic command for every available Version of yii around.

That’s why i have made some thoughts on how to make the yiic webapp and yiic crud Generator even more intelligent and i came to the conclusion, that this shouldn’t really be difficult!

Why don’t we just generate our default Web-Skeleton with Yii:t(‘app’, ‘This is the english default string’) everywhere, where a string occurs?

After this, we create a messages/<lang>/app.php containing our most default webapp/crud strings.

Pro: We only need to add these strings to our messages/<lang>.php - once and for all time. This translations would be shipped along with the whole bunch of translations already available with Yii.

Cons: The ‘default’ Web-App is capable of i18n even if we don’t want/need it. This is some (minor?) overhead.

To solve the cons, we could make it optional, something like php yiic webapp --with-i18n resp. crud MODEL --with-i18n

Does this make sense?

If so - i would really be happy to make such an extension, maybe in mid of February, and maybe, if this feature get’s tested and bug-free we could think about moving this to yii-core (maybe 1.2)…

I couldn’t sleep and created a demonstration extension, showing what i mean.

There are already german translations in messages/de.

Since i am not permitted to upload .tar.bz2 files to this forum; it is availabe at

http://80.86.84.191/i18ncrud.tar.bz2

Just extract it in your application-root and CRUD your models using the i18ncrud command.

Please test & comment this, thank you !!!

I think it’s a great idea!

But, instead of using


crud MODEL --with-i18n

I would make CRUD make use of config/main language configuration