PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Strange plugin translation problem

  1. Hi,
    I have gravity forms in conjunction with wpml's gravity forms multilingual and I can translate the form I have created fine, but I have a problem with the plugin translation.
    I have two languages in wpml, catalan and spanish, being catalan the default one. The problem I have is that I have created a (very basic) catalan .mo, but (with the web in catalan) the form errors (required fields for instance) are shown in spanish. Locale is "ca" and works fine with wp or nextgen gallery, but even, I tried different .mo names or tried using a valid .mo (finnish one specifically) to see if the problem was my .mo file. But the form error messages still appear in spanish.
    Another strange thing is that in admin everything is shown in catalan (wordpress, nextgen gallery, ...), but gravity forms is shown in spanish! Should not default to english if catalan translation is not present? I also tried changing some admin strings in the catalan translation, but everything was still shown in spanish.
    Any help would be appreciated!
    Thanks in advance
    Pau

    Posted 7 years ago on Thursday February 21, 2013 | Permalink
  2. David Peralty
    Administrator

    What is your WordPress set to in wp-config? If the language is defined as Spanish, then that's what Gravity Forms would use.

    Posted 7 years ago on Thursday February 21, 2013 | Permalink
  3. wp-config is set to spanish, but other plugins get the locale from WPML, that is why is "strange". With this information you gave me I did some more searching and I found this page that explains why some plugins got the WPML language while gravity forms don't. I changed the gravity forms code and now it works as I expected.

    To summarize the content on the page:

    Moving the call to load_plugin_textdomain() to the init action gave WPML time to set the locale first:

    add_action( 'init', 'plugin_init' );
    
    function plugin_init() {
      // localization in the init action for WPML support
      load_plugin_textdomain( 'my_textdomain', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
    }

    I have changed the code in my install, but that will break the updates, can you evaluate changing your code to make the plugin fully WPML compatible? I don't know if it breaks anything (in my quick test didn't find anything wrong), but it will be a plus, besides, WPML lists gravity forms as a multilingual form plugin, so it will play nice.
    Thanks for your help
    Pau

    Posted 7 years ago on Thursday February 21, 2013 | Permalink
  4. David Peralty
    Administrator

    I've let our developers know about it. All my best!

    Posted 7 years ago on Thursday February 21, 2013 | Permalink
  5. saverio.daronco
    Member

    Thanks Pau, your suggestion solved the same problem I faced with an Italian-German WP installation.
    Wainting for a plugin update to solves the problem officially.
    Saverio

    Posted 7 years ago on Thursday February 28, 2013 | Permalink

This topic has been resolved and has been closed to new replies.