• 0
Sign in to follow this  
Followers 0

How to translate my own section ?

Question

Posted · Report post

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

load_theme_textdomain("my-domain", $this->base_url);

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 ?

Share this post


Link to post
Share on other sites

7 answers to this question

  • 0

Posted · Report post

I apologize but I'm not too familiar with translations, but our developer wrote this post which may help you: http://www.pagelines.com/forum/discussion/17169/how-to-change-a-text-string-with-poedit./p1

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

@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 [code]function section_optionator( $settings )[/code]can be translate perfectly. But All strings which I used in [code]function section_template[/code] will not be translated. So , can pagelines developer help me to solve this ?

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

http://codex.wordpress.org/Function_Reference/load_theme_textdomain You are using the function wrong. It has to be loaded with after_setup_theme hook http://codex.wordpress.org/Plugin_API/Action_Reference/after_setup_theme

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

here is my code in my section.php : [code] function section_template(){ add_action('after_setup_theme', 'my_theme_setup'); function my_theme_setup(){ load_theme_textdomain('my_theme', $this->base_dir ); } ?>
%s',__('ready','my_theme')); ?>
oset); ?>

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

Please paste your whole section here: http://paste.pagelines.com

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

I have already paste it . [url]http://paste.pagelines.com/2k[/url] Thanks in advance.

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

http://paste.pagelines.com/7f This works. I will add a translation function to make it easier for devs.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0