Viewing 10 reply threads
  • Author
    Posts
    • #340
      Miguel
      Participant

      Hi all.
      I want to know how to manage the translation of the “title of the metabox” ( and other text in the framework) that is defined in the comments.

      <?php
      /*
      Title: My Demo Meta Box
      Post Type: post
      */

      Thanks from Spain.

      Miguel.

    • #341
      Steve
      Keymaster

      @gnomonet– Piklist automatically uses get_text to display text. You should be able to create a PO file with your translations.

      Let us know if you have any problems. This area of Piklist may require a little help.

    • #342
      Daniel Ménard
      Participant

      @Steve- I had the same question some times ago and I’m not sure that your suggestion is doable : from what I see, piklist loads the string from text-domain “piklist” and not from the text-domain of the plugin:

      add_meta_box( ... __($data['name'], 'piklist') ...)

      If I add a string in my PO with domain “piklist”, it seems that wordpress ignores it:

      #@ piklist
      msgid "test"
      msgstr "translation of test"

      I guess that wp don’t like PO files with multiple text-domains (plugins like “CodeStyling Localization” warn about that)…

      Any clue?

      Cheers,
      Daniel

    • #344
      Miguel
      Participant

      OK, i´ll test it.
      I´m using WPML in most sites

      ” it´s a multilingual World” 😉

    • #487
      emzo
      Participant

      @Miguel Can you translate those strings using the WPML String Translation module?

    • #488
      Miguel
      Participant

      please, install a plugin like “piglatin” and you will see if all the strings are translatable.

      http://wordpress.org/extend/plugins/piglatin/

    • #490
      Steve
      Keymaster

      @Miguel– Using Pig Latin and it’s very helpful! We’ll be moving forward with better localization.

    • #3853
      graup
      Participant

      Hi, any updates on this? Is it possible to translate the text inside the comments?

    • #3854
      Steve
      Keymaster

      @graup– Currently this is not possible. We are working on a solution.

    • #9530
      Nabil
      Participant

      I’m satisfied with this workaround:

      
      <?php
      
      // File: parts/meta-boxes/my-metabox.php
      
      /**
       * Title: {{ My Metabox }}
       * Post Type: my_cpt
       */
      	
      piklist( 'field', [
      	'type' => 'file',
      	'field' => '_thumbnail_id',
      	'scope' => 'post_meta',
      	'options' => [
      		'title' => __( 'Set featured image(s)', 'my_textdomain' ),
      		'button' => __( 'Set featured image(s)', 'my_textdomain' ),
      	],
      ] );
      
      /**
       * Localize Title
       */
      add_action('piklist_pre_render_meta_box', function() {
      	ob_start();
      } );
      add_action('piklist_post_render_meta_box', function() {
      	echo str_replace( '{{ My Metabox }}', __( 'My Metabox', 'my_textdomain' ), ob_get_clean() );
      } );
      
    • #9535
      Steve
      Keymaster

      Piklist v1.0.5 now does this automatically. Just add your translations to your .po file and Piklist will translate everything including the comment block titles.

Viewing 10 reply threads
  • The topic ‘title translation’ is closed to new replies.