Yii Framework Forum: lowercase in the internationalization - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

lowercase in the internationalization

#1 User is offline   Daniel 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 295
  • Joined: 26-September 09

Posted 03 December 2017 - 10:30 PM

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
0

#2 User is online   alrazi 

  • Elite Member
  • Yii
  • Group: Moderators
  • Posts: 1,489
  • Joined: 08-August 12
  • Location:Durban, South Africa

Posted 04 December 2017 - 12:21 AM

perhaps apply strtolower to your title before you pass it to translation function something like

Yii::t('app', '{title} listing', ['title' => strtolower($this->title)])

0

#3 User is offline   Daniel 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 295
  • Joined: 26-September 09

Posted 04 December 2017 - 03:24 AM

View Postalrazi, on 04 December 2017 - 12:21 AM, said:

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.
0

#4 User is online   alrazi 

  • Elite Member
  • Yii
  • Group: Moderators
  • Posts: 1,489
  • Joined: 08-August 12
  • Location:Durban, South Africa

Posted 04 December 2017 - 05:25 AM

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}'

1

#5 User is offline   Daniel 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 295
  • Joined: 26-September 09

Posted 08 December 2017 - 08:08 PM

View Postalrazi, on 04 December 2017 - 05:25 AM, said:

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.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users