• Hi,

    This is David from the WPML compatibility team. We received a report in our support forum about translating custom taxonomy labels and we’d like to share the solution with you.

    It requires 2 steps:

    1) Add a file called wpml-config.xml to the root folder of your plugin:

    <wpml-config>
      <admin-texts>
        <key name="woof_settings">
          <key name="custom_tax_label">
            <key name="*"/>
          </key>
        </key>
      </admin-texts>
    </wpml-config>

    This tells WPML which settings require translation.
    You will find the strings ready for translation in WPML -> String Translation

    2) Apply this patch (add 3 lines):

    Index: classes/helper.php
    ===================================================================
    --- classes/helper.php	(revision 1919570)
    +++ classes/helper.php	(working copy)
    @@ -235,6 +235,9 @@
             if (class_exists('SitePress')) {
                 $lang = ICL_LANGUAGE_CODE;
                 $woof_settings = get_option('woof_settings');
    +            if (is_object($taxonomy_info)) {
    +                $string = $woof_settings['custom_tax_label'][$taxonomy_info->name];
    +            }
                 if (isset($woof_settings['wpml_tax_labels']) AND ! empty($woof_settings['wpml_tax_labels'])) {
                     $translations = $woof_settings['wpml_tax_labels'];
                     //$translations = unserialize($translations);

    With these 3 lines we will pick up the translation we added before.

    Let me know if you would consider including this fix in your plugin to give our shared users a better experience.

    Initially reported in https://wpml.org/de/forums/topic/problem-with-taxonomy-translation-2/

    Thanks
    David Garcia Watkins
    david.g@onthegosystems.com

  • The topic ‘Translating custom taxonomy labels with WPML’ is closed to new replies.