Jump to content
infoadvisor

Simple translation patch for Pagelines

Recommended Posts

infoadvisor    0
infoadvisor

Hi,

 

I have a little suggestion for developers. I want to translate PL menu in admin panel, but it is not so simple. Adding i18n for ui_key function in library.functions.php like that:

 

function ui_key($key){

-    return ucwords( str_replace( '_', ' ', str_replace( 'pl_', ' ', $key) ) );
+    if($key[0]=='_')
+        $key=substr($key,1);
+    return __(ucwords( str_replace( '_', ' ', str_replace( 'pl_', ' ', $key) ) ),'pagelines');
}

Could be much useful.

 

Share this post


Link to post
Share on other sites
Danny    1,327
Danny

Hi,

 

Not sure why you would want to translate the PageLines settings name, as its our brandname. Its the same for brands like Coke Cola, the branding isn't translated, it remains the same throughout most countries.


Please search our forums, before posting!

Share this post


Link to post
Share on other sites
infoadvisor    0
infoadvisor

I don't want to translate "Pagelines" or anything related with your brand. Just menu items like "Site Options" or "Drag & Drop" could be translated for better understanding, especially in European languages :)

Share this post


Link to post
Share on other sites
Danny    1,327
Danny

As far as I am aware, it is already possible to translate the backend options, see our translation center - http://www.pagelines.com/translate/projects/pagelines-framework/nl/full?filters%5Bterm%5D&filters%5Buser_login%5D&filters%5Bstatus%5D=current_or_waiting_or_fuzzy_or_untranslated&sort%5Bby%5D=original&sort%5Bhow%5D=desc&sorts=Sort&page=14

The Dutch full translation has store translation to Winkel, which I assume is a correct translation.


Please search our forums, before posting!

Share this post


Link to post
Share on other sites
infoadvisor    0
infoadvisor

I've tested Dutch translation, and all tabs names in admin are still in english. The only way I know is add __() method to ui_key, as i wrote. Of course i can do this manually, but integrating it with core could be helpful thing :)

Share this post


Link to post
Share on other sites
Simon    247
Simon

No sorry that simply wont work.

 

The translation script scans the file for translation strings, it is NEVER actually executed, so:

 

__( 'hello', 'domain' );

would produce:

msgid "hello"
msgstr ""

 

__(ucwords( str_replace( '_', ' ', str_replace( 'pl_', ' ', $key) ) ),'pagelines');

would produce:

msgid ""
msgstr ""

 

So pointless.

 

A better idea would be:

 

function ui_key($key){


    $word = ucwords( str_replace( '_', ' ', str_replace( 'pl_', ' ', $key) ) );
    return apply_filters( 'pl_ui_key', $word, $key );
}
 
Now you can use a filter to do your translation.

Share this post


Link to post
Share on other sites
Simon    247
Simon

If you test this and it works, I dont mind adding it to core.

Share this post


Link to post
Share on other sites
infoadvisor    0
infoadvisor

I made other plugin to generate items for gettext scanner, but idea with filters is much better :)

Adding it to core could be great.

 

Thanks.

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


  • Similar Content

    • DonRicardoRVM
      By DonRicardoRVM+
      I need to translate the quickshop plugin to spanish, but I can´t do it. I edit the pot file, and compile the spanish translation in es_ES.mo and es_ES.po, bu it doesn´t works.
      Pleasu, could somebody help me?
    • Kedark
      By Kedark+
      Hello, when you update the DMS to the latest version 2.2.4, unfortunately, does not work translation theme. Has anyone encountered this? It looks as if the file with the translation was not read .. everything is in the original language. (Wordpress is also updated to the latest version)
      Help....
      RKA
    • DonRicardoRVM
      By DonRicardoRVM+
      HI!
       
      First of all, sorry for my bad english.
       
      I have a problem that I never could solve: I can´t translate the words "READ MORE" in the loop. Where must I translate them?
       
       
    • thwarted
      By thwarted
      Folks,   We're adding the finishing touches to an iBlogPro v1.2 site and have come up against a small issue with the Translate Content on Scroll style for Canvas Areas:   [Canvas Area] > Area Styling > Scrolling effects and sizing > Translate Content on Scroll   It creates a pleasingly modern appearance BUT when the browser is windowed and set wider than it is tall, the parallax effect causes the Canvas contents to fade and become obscured by the next object down the page moving up when you start scrolling. Even when the browser window is made taller, the object below begins its transition up the page far too early, leaving the bottom part of the Canvas always obscured and never visible.   I was wondering if this effect had any UI properties or other configuration? I don't mind editing the code that makes it work, but would rather have some pointers from you guys first.   (Incidentally I have no way of knowing precisely what version of DMS I'm using. Is there an 'about' page detailing everything I have installed? I've seen plenty of references to DMS 2 but the only version I can find by looking at the theme entry is iBlogPro v1.2.)
    • ketri
      By ketri
      Hi!
      I'm having two problems with my translations. I've shown them in this video:
      https://www.youtube.com/watch?v=Bq2jXeHbd7o
       
      1. When I click edit from any element on page, it's very slow and laggy. If I remove the translations from the themes it then works normally. Why does translation affect this?
      2. My site is using the translation files from the DMS parent theme. The translations in my child theme (western-spirit) only work if I delete the translations from the DMS parent theme. I tried different functions in my child-theme to make it load the translations from there but they didn't work. I tried these:
      function my_child_theme_setup() {load_child_theme_textdomain( 'Western Spirit', get_stylesheet_directory() . '/languages' ); } add_action( 'after_setup_theme', 'my_child_theme_setup' ); and 
      load_theme_textdomain( 'dms', get_stylesheet_directory() . '/languages' ); I also noticed than in these functions for example here http://codex.wordpress.org/Function_Reference/load_child_theme_textdomainthey always have /languges but DMS-theme has /language without the "s".
       
      So I want to edit my site without the weird lagginess that appears when I have translations and I want to use the latest translations from Transifex on my child-theme so my translations won't disappear when I update DMS
       
      Thanks!
×