Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter xsid

    (@xsid)

    @garnitchique Ya, sure: just change function “wpm_translate_string” in <plugin_dir>/includes/wpm-translation-functions.php to

    function wpm_translate_string( $string, $language = '' ) {
    
    	if ( ! wpm_is_ml_string( $string ) ) {
    		return $string;
    	}
    
    	$strings = wpm_string_to_ml_array( $string );
    
    	if ( ! is_array( $strings ) || empty( $strings ) ) {
    		return $string;
    	}
    
    	if ( ! wpm_is_ml_array( $strings ) ) {
    		return $strings;
    	}
    
    	$languages = wpm_get_languages();
    
    	if ( $language ) {
    		if ( isset( $languages[ $language ] ) ) {
    			return $strings[ $language ];
    		}
    
    		return '';
    	}
    
    	$language         = wpm_get_language();
    	$default_language = wpm_get_default_language();
    
    	if ( isset( $strings[ $language ] ) && ( '' === $strings[ $language ] ) && get_option( 'wpm_show_untranslated_strings', 'yes' ) === 'yes' ) {
    		$default_text = apply_filters( 'wpm_untranslated_text', $strings[ $default_language ], $strings, $language );
    		if ( strlen( $default_text ) > 0 ) {
    			return $default_text;
    		} else {
    			$langs            = wpm_get_languages();
    			$new_default_text = '';
    			foreach ( $langs as $key => $lang ) {
    				if ( strlen( $new_default_text ) == 0 ) {
    					$new_default_text = apply_filters( 'wpm_untranslated_text', $strings[ $key ], $strings, $language );
    				}
    			}
    			if ( strlen( $new_default_text ) > 0 ) {
    				return $new_default_text;
    			}
    		}
    	}
    
    	if ( isset( $strings[ $language ] ) ) {
    		return $strings[ $language ];
    	}
    
    	return '';
    }
    Thread Starter xsid

    (@xsid)

    Never mind, I’ve rewrited the plugin core to implement this feature. Thank you!

    What are you talking about??? Today I’ve got a great support and resolve my problem with plugin in 20 minutes! Before I choose this plugin I’ve installed many others (include this one) and delete them without any problem. I think that issue in your case was not in the plugin itself. Just always read docs first!

Viewing 3 replies - 1 through 3 (of 3 total)