Translate Form Label.

Home Forums Quform WordPress Translate Form Label.

This topic is: not resolved
Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #20810
    alessio.candelma
    Participant

    Hi,

    I read how translate the form.
    But how I can translate form labels I create?

    If I create a form, it’s not possible translate by translating .po file.

    Thanks

    Alessio

    #20819
    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

    #20831
    Venom
    Participant

    Hi

    May I know the schedule of the next major update that we can decide the approach for development.

    Regards,

    Venom

    #20834
    Allan
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

    #24155
    tonitarres
    Participant

    Hi,
    Is possible now, translate Labels with WPML?

    Thanks

    #24202
    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

    #26377
    Venom
    Participant

    Hi,

    I want to propose a workaround for adding support multi language for fields or labels.

    A shortcode would be created to surround the Quform that will act as global string replacement for the form before rendering at the client side. I am using WPML, therefore, I could retrieve the current language running apply_filters( ‘wpml_current_language’, NULL );

    [eventitect_i18n_replace]
    [quform id="XX" name="Form Name"]
    [/eventitect_i18n_replace]

    
    function strip_tag($str_text, $tag){
     $regex = '~\['.$tag.'[^]]*\](.+?)\[/'.$tag.'\]~';
     $str_text = preg_replace($regex, '$1', $str_text);
    
     return $str_text;
    
    }
    
    function replace_tag_content($str_text, $tag, $replacement) {
        $reg_str = '/\['.$tag.'\](.*)\[\/'.$tag.'\]/U';
        preg_match_all ($reg_str, $str_text, $pat_array);
    
        foreach($pat_array[0] as $val) {
           $str_text =  str_replace($val,$replacement,$str_text);
        }
       return $str_text;
    }
    
    function eventitect_i18n_replace($atts = [], $content = null, $tag = ''){
      
      $lang_current = apply_filters( 'wpml_current_language', NULL );
      $return_string = do_shortcode($content);
      if($lang_current == 'zh-hant'){  
        $return_string  = replace_tag_content($return_string , 'en', '');
        $return_string = strip_tag($return_string , 'tw');
      }else if($lang_current == 'en'){  
        $return_string  = replace_tag_content($return_string , 'tw', '');
        $return_string = strip_tag($return_string , 'en');
      }
        
      return $return_string;
           
    }
    add_shortcode('eventitect_i18n_replace', 'eventitect_i18n_replace');
    

    Would it be easier to implement this feature to the Quform for future version?

    Regards,

    Venom

    • This reply was modified 5 years, 9 months ago by Venom.
    Attachments:
    You must be logged in to view attached files.
    #26461
    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.
Be inspired. © 2024 ThemeCatcher Ltd. 20-22 Wenlock Road, London, England, N1 7GU | Company No. 08120384 | Built with React | Privacy Policy