I was looking at how Yii does translations and really find having sentences instead of variables an issue.
Is there an alternative solution to over ride what the core does?
I’m thinking that all languages should be separate from the code.
So…
Yii:t(‘accounts’, ‘please click any new users you wish to remove’)
To be honest, this is really hard to deal with for users who are not native speakers and it’s very hard to change something on the fly.
Is it possible to change it to:
Yii:t(‘accounts’, ‘button_remove_new_user’)?
You could then have:
title_xyz
text_xyz
button_xyz
Basically refer to everything like a variable. That way if I didn’t want to use “Please click to remove any new users or any other offending dork users” I could just use “remove dork”
and use variables as literals. sourceLanguage=var is just something that is for sure not used as another language so everytime yii will seek for translation file.
Yii loads translation file first time Yii::t is called and there is no file loaded for current language. You can use Yii::t wherever you want (actions/widgets/views). Translation you have to provide on your own (there is "yiic message" command which helps to generate new translation files). There is however dedicated solution for translating views - if there is a subdirectory that match language and there is view file with same name - it will be used. Example: