• Resolved vpgomes

    (@vpgomes)


    I have a website with three languages. I need help changing the value off the button, based on the language.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author WebToffee

    (@webtoffee)

    Hi @vpgomes,

    Please mention which multilanguage plugin are you using in the site.
    Eg, WPML, Polylang etc.

    Thread Starter vpgomes

    (@vpgomes)

    None, I’m using two functions:

    
    function translation($pt, $en, $es) {
      $lang = get_site_language();
    
      if ($lang === 'en') {
        return $en;
      } elseif ($lang === 'es') {
        return $es;
      } else {
        return $pt;
      }
    }
    
    function get_site_language() {
      $uri = get_page_uri();
    
      if (strpos($uri, 'en') === 0) {
        return 'en';
      } elseif (strpos($uri, 'es') === 0) {
        return 'es';
      } else {
        if ($_GET['lang'] == 'en' || $_GET['lang'] == 'es') {
          return $_GET['lang'];
        } elseif (preg_match('/\/[posts|category|tag]\-en/', $_SERVER['REQUEST_URI'])) {
          return 'en';
        } elseif (preg_match('/\/[posts|category|tag]\-es/', $_SERVER['REQUEST_URI'])) {
          return 'es';
        } else {
          return 'pt';
        }
      }
    }
    Plugin Author WebToffee

    (@webtoffee)

    Hi @vpgomes,

    Please use any of the compatible plugins for multilanguage support. You can use WPML, Polylang, Qtranslate etc.

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

The topic ‘Translation off accept_all value’ is closed to new replies.