Jump to content


Photo
- - - - -

How to translate my own section ?


  • Please log in to reply
7 replies to this topic

#1 kakadong

kakadong

    Super Member

  • Members

  • 113 posts
  • LocationTaiwan

Posted 11 March 2012 - 06:00 PM

I have made a section .
I want to translate in other Language.
In function section_optionator( $settings ) ???all string with __() can show correctly.

but all of the string I used in function section_template can't show my translation

I used

Please Login or Register to see this Hidden Content

in function section_template .

and the string which I want to translate is __('7 reason to subscribe','$this->base_url').

but I will only show ' 7 reason to subscribe ' on my page . not the string I want to translate.

So, is there anyone can tell me exactly how it works ?

#2 Rob

Rob

    One Smart Egg

  • Members
  • 13575 posts
  • LocationEast Coast, USA
  • Framework Version:The Latest, of course
  • Country: Country Flag

Posted 11 March 2012 - 09:03 PM

I apologize but I'm not too familiar with translations, but our developer wrote this post which may help you:

Please Login or Register to see this Hidden Content



#3 kakadong

kakadong

    Super Member

  • Members

  • 113 posts
  • LocationTaiwan

Posted 12 March 2012 - 01:46 AM

@rangelone Thanks for your reply.
I have already read the post. Unfortunatly,it's not the case .
the post is tell us how to translate the Pagelines framwork.
it already has a .pot file.
so I can easily translate into what I want.
But my case is to translate the section which I made.
there is no .pot or .po in my section.
I have to create one.
Since that's not a problem for me.
but,I don't know Why the string in

Please Login or Register to see this Hidden Content

can be translate perfectly. But All strings which I used in

Please Login or Register to see this Hidden Content

will not be translated.

So , can pagelines developer help me to solve this ?

#4 Simon_P

Simon_P

    Messer

  • Administrators



  • 8388607 posts
  • LocationDevon
  • Framework Version:2.1.1
  • Country: Country Flag

Posted 12 March 2012 - 03:01 AM

Please Login or Register to see this Hidden Content

You are using the function wrong. It has to be loaded with after_setup_theme hook

Please Login or Register to see this Hidden Content



#5 kakadong

kakadong

    Super Member

  • Members

  • 113 posts
  • LocationTaiwan

Posted 12 March 2012 - 08:41 PM

here is my code in my section.php :

Please Login or Register to see this Hidden Content


and two files zh_TW.po and zh_TW.mo in the same dir .
still not work.
so , what's the problem?

#6 Simon_P

Simon_P

    Messer

  • Administrators



  • 8388607 posts
  • LocationDevon
  • Framework Version:2.1.1
  • Country: Country Flag

Posted 13 March 2012 - 07:15 PM

Please paste your whole section here:

Please Login or Register to see this Hidden Content



#7 kakadong

kakadong

    Super Member

  • Members

  • 113 posts
  • LocationTaiwan

Posted 14 March 2012 - 09:40 AM

I have already paste it .

Please Login or Register to see this Hidden Content



Thanks in advance.

#8 Simon_P

Simon_P

    Messer

  • Administrators



  • 8388607 posts
  • LocationDevon
  • Framework Version:2.1.1
  • Country: Country Flag

Posted 15 March 2012 - 07:30 PM

Please Login or Register to see this Hidden Content

This works. I will add a translation function to make it easier for devs.