Publisher does not support the Fluid field type. Please do not contact asking when support will be available.

If you purchased an add-on from expressionengine.com, be sure to visit boldminded.com/claim to add the license to your account here on boldminded.com.

Ticket: “Get language from browser” setting not working

Status Resolved
Add-on / Version Publisher
Severity Critical
EE Version

Timothy Kelty

Jul 08, 2013

I’m testing the “Get language from browser” setting ( I changed my Chrome settings to have all Chinese on top), but it’s not working.

My $_SERVER[‘HTTP_ACCEPT_LANGUAGE’] outputs as:
zh,zh-CN;q=0.8,zh-TW;q=0.6,en-US;q=0.4,en;q=0.2

I have en and zh languages in Publisher, but it always goes to en.

It looks like the problem is in Publisher_session->find_language:
The “$available” array is just an array of ids, not short_names. Maybe they used to be keyed by short_name?

`$available = $this->parseLanguageList(implode(’,’, array_keys(ee()->publisher_model->get_languages(‘short_name’))));`

$accepted looks like:

array (size=5)
  '1.0' => 
    array (size=1)
      0 => string 'zh' (length=2)
  '0.8' => 
    array (size=1)
      0 => string 'zh-cn' (length=5)
  '0.6' => 
    array (size=1)
      0 => string 'zh-tw' (length=5)
  '0.4' => 
    array (size=1)
      0 => string 'en-us' (length=5)
  '0.2' => 
    array (size=1)
      0 => string 'en' (length=2)

Also - I think your edit issue form is broken, I keep putting in the ee and addon version but it doesn’t stick!

#1

Timothy Kelty

using the publisher_model->get_language_codes() instead seems to do the trick:

line 896 of Publisher_session.php

$available = $this->parseLanguageList(implode(',', ee()->publisher_model->get_language_codes()));
#2

BoldMinded (Brian)

Thanks, Tim. I’ll take a look at this tonight.

#3

BoldMinded (Brian)

Yep, that seems to fix it. Thanks for this patch. Will be in 1.0.2.

Login to reply