adinugro
(Adinugro)
December 4, 2017, 3:30am
1
Dear all,
Having internationalization in yii is very great. Although, my language is having different way to compose a sentence, I can handle it in yii with ease. For example,
Yii::t('app', '{title} listing', ['title' => $this->title])
'{title} listing' => 'Daftar {title}',
I just need one more help. Say I have "Items listing" and want to translate it to "Daftar item". Using above trick, I can already produce "Daftar Item", but I want to lowercase the "item" to produce "Daftar item". How can I achieve this?
Thanks in advance.
Daniel
alirz23
(Ali Raza)
December 4, 2017, 5:21am
2
perhaps apply strtolower to your title before you pass it to translation function something like
Yii::t('app', '{title} listing', ['title' => strtolower($this->title)])
adinugro
(Adinugro)
December 4, 2017, 8:24am
3
perhaps apply strtolower to your title before you pass it to translation function something like
Yii::t('app', '{title} listing', ['title' => strtolower($this->title)])
I also need to be still in uppercase when shown in English…only lowercase when shown in Indonesian.
alirz23
(Ali Raza)
December 4, 2017, 10:25am
4
I am not sure if there is an ICU format available for this but simplest possible solution I can think of
Yii::t('app', '{title} listing', ['title' => $this->title, 'titleLower' => strtolower($this->title)])
and your message could be as following
'{title} listing' => 'Daftar {titleLower}'
adinugro
(Adinugro)
December 9, 2017, 1:08am
5
I am not sure if there is an ICU format available for this but simplest possible solution I can think of
Yii::t('app', '{title} listing', ['title' => $this->title, 'titleLower' => strtolower($this->title)])
and your message could be as following
'{title} listing' => 'Daftar {titleLower}'
Thanks a lot alrazi, it works like a charm.