• Hi! I’ve tried WC Fields Factory in my staging site and so far, it looks amazing! Congrats for what you’ve achieved! It’s packed with options and looks so good in the frontend. And if it’s true that you’re adding conditional fields like this topic suggests, you’ll be the real deal!

    However, I can’t make it work with WPML. I enable the multilingual option, set the first and second languages properly, translate the fields (values, placeholders…) but the translated version doesn’t show up, just the first language version. I’m sure I’m doing something wrong about it. Any hint? Thank you!

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Contributor Sark

    (@sarkware)

    Thank you, and yes the conditional checkout field option is in pipeline and will be available with the upcoming release.

    Regarding the WPML compatiblity issue, can you pls share the product page url.

    Thread Starter codimex

    (@codimex)

    Hi. Sark! Thank you for answering. Unfortunately, I can’t share an url here, since, as I said, I’m running it in a staging site, and I don’t know if I’ll be managing this client in the future.

    I’ve read the instructions here. If your plugin determines language by using their ICL_LANGUAGE_CODE constant (which, as a matter of fact, I don’t really know what is it), is there any way I can check on my end if this is working? Perhaps I’m facing this issue because it is a staging site (I’m not ready to go live yet).

    I know it’s hard to help if we don’t provide an url, but any help would be really appreciated given the circumstances. Thank you again!

    Thread Starter codimex

    (@codimex)

    Looks like the ICL_LANGUAGE_CODE constant is deprecated (official link here). Maybe this has something to do with the issue. Any ideas?

    Plugin Contributor Sark

    (@sarkware)

    Pls update the the following function detrmine_current_locale in the plugins/wc-fields-factory/includes/wcff_locale.php with the following

    /**
         * 
         * Detect the current locale of the Browser
         * 
         * @return string
         * 
         */
        public function detrmine_current_locale() {
        	
            /* Step 1 - get the default locale from the Settings */
    
            $wcff_options = wcff()->option->get_options();
            $locale = isset($wcff_options["default_locale"]) ? $wcff_options["default_locale"] : "en"; 
    
            /* Step 2 - try to determine the locale from incoming http header */
    
        	/* Locale from Browser */
        	if(function_exists("locale_accept_from_http")) {
        		$locale = locale_accept_from_http($_SERVER['HTTP_ACCEPT_LANGUAGE']);
        	} else {
        		if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
        			$locale = $_SERVER['HTTP_ACCEPT_LANGUAGE'];
        		}
        	}
        	
            /* Step 3 - Try to get locale from wp itself */
            
            if (function_exists("pll_current_language")) {            
                $locale = determine_locale();
            }
    
            /* Step 4 - try to get from WPML - if it exist */
            if (has_filter("wpml_current_language")) {
                $locale = apply_filters( 'wpml_current_language', NULL );
            }
    
        	/* Right now WC Fields Factory does support all ISO languages (codes)
        	 * but not the locale variants for a single language,
        	 * So we have to map all the locales to ISO codes, lilke 'en_US' will be just 'en' */
        	if($locale) {
        		$locale = $this->check_locale($locale);
        	} else {
                /* If something messed from the previous steps, roll back to default locale */
        		$locale = isset($wcff_options["default_locale"]) ? $wcff_options["default_locale"] : "en";
        	}
    
        	return $locale;
    
        }
    Thread Starter codimex

    (@codimex)

    Ohh, the code looked promising, but unfortunately this doesn’t work for me. I see that you’ve added a specific validation for WPML (step 4), but, still, I’m getting the same default language strings in both default and supported languages, ignoring the translations.

    At this point, I don’t know what else to do to make it work for me. I’ll try different options and, in case I’ll solve it, I’ll post my working solution here. On the other hand, if you come up with a different approach, I’d really appreciate any help.

    Thank you for your willingness to help, Sark! Have a nice week.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘WPML compatibility’ is closed to new replies.