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: publisher language mixup?

Status Resolved
Add-on / Version Publisher 2.10.1
Severity
EE Version 4.3.6

Matthias Ballmann

Oct 17, 2018

hi brian,

we have an issue where we think publisher may play a role in… but we don’t know if we are right and what’s going on.
I wrote about this with ee’s robin for days… and she thinks it may have to do with publisher.

so, we use some code to show on a museum’s multilingual website when an exhibition runs only for 7 days, 6 days… til the last day.
this is a simplified version from robin to show the problem:

publisher code: {publisher:current_language_code} EE lang: {lang}
<br><br>
DE: 
<span class="attn">{variable_time:relative date="+33 hours" units="days" future="Nur noch %s" about=""}</span>

<br><br>
EN: 
<span class="attn">{variable_time:relative date="+33 hours" units="days" future="Only %s" about=""}</span>

we want it to show the “countdown” in german as well as in english.
but when we switch this to english, it show the german word for day(s) which is “Tag(e)”:
this is the rendered output of the code above:

https://kv18.kunstverein.de/ausstellungen/t2

do you see the mysterious problem?
we checked with publisher’s settings and their are the correct language files asigned to each language.


thank you
and kindest regards,
matthias

#1

BoldMinded (Brian)

What is variable_time? I don’t fully understand what is happening here. Is this inside an entries tag? I don’t have enough context to make any assumptions.

#2

BoldMinded (Brian)

There is a slight change I need to do to Publisher to make sure the correct lang file is loaded, but I think this is a core EE issue.

The core_lang.php file shows the translation for days:

system/ee/legacy/language/english/core_lang.php:
  232  'day' => 'day',
  233  
  234: 'days' => 'days',
  235  
  236  'hour' => 'hour',

system/ee/legacy/language/english/date_lang.php:
   17  'date_day' => 'Day',
   18  
   19: 'date_days' => 'Days',
   20  
   21  'date_hour' => 'Hour',

And the core_lang.php file in the German language pack EllisLab provides from their GitHub account does not have a translation for days. Line 234 of core_lang.php looks like this:

'days' => 'days',

They need to either add the translation to the German core_lang.php file, or update Relative_date.php->render() method to use the values from the date_lang.php file.

I will send you a new build tomorrow with the fix on my side, but it won’t matter unless the lang files are updated.

#3

BoldMinded (Brian)

Even if you edited the Lang file you still need the new build, which I’ll send tomorrow.

#4

BoldMinded (Brian)

This is more of a question for EllisLab. Even when Publisher sets ee()->session->userdata[‘language’] = ‘deutsch’ the German core_lang.php file is not loaded again to override the default one. And the CP setting states that the language file is only used in the CP, not on the front-end, so how is a non-logged in user supposed to set their language preference. Is it expected that the relative date functionality would use a non-English translation on the front-end? B/c from what I can tell it doesn’t appear to be setup that way.

https://www.dropbox.com/s/w64qwjzw55ycyg2/Screenshot 2018-10-18 07.03.46.png?dl=0

If the Relative_date.php render() function was updated to include this line ee()->lang->load(‘date’); and the key updated to what I have below, then the translation would work, but right now there is no way to override the core_lang file.

lang('date'.$key)
#5

Matthias Ballmann

mmh, ok. we very much love your software and from all the work with publisher and your support here I know that you care deeply about the issues it may cause. therefor I believe you know what you say.

but: all language preferences in ee and in publisher are switched to german. and since the code I sent you was robin’s (for simplification purposes) this is part of the real code that shows how languages are choosen:

{if publisher:current_language_code == "de"}
 <span class="attn">{expiration_date:relative units="Tage" future="Nur noch %s" about=""}</span>
{if:else}
 <span class="attn">{expiration_date:relative units="Days" future="Only %s" about=""}</span>
{/if}

the whole partial, that is called inside a channel tag is:

{if expiration_date > current_time AND expiration_date < {variable_time date="+8 days"}}
 {if expiration_date < {variable_time date="+2 days"}}
  {if expiration_date > {variable_time date="+1 days"}}
   <span class="attn">{phrase:nur_noch_1_tag}</span>
  {if:else}
   <span class="attn">{phrase:heute_zum_letzten_mal}</span>
  {/if}
 {if:else}
  {if publisher:current_language_code == "de"}
   <span class="attn">{expiration_date:relative units="Tage" future="Nur noch %s" about=""}</span>
  {if:else}
   <span class="attn">{expiration_date:relative units="Days" future="Only %s" about=""}</span>
  {/if}
 {/if}
{/if}

does this make any difference in your opinion about the cause?

#6

BoldMinded (Brian)

Matthias, I’ll work on getting this fixed, but it may take a few days.

#7

Matthias Ballmann

so it’s a problem with publisher after all? that’s fine with me, i just want to understand what it is - and neither you nor robin get on your nerves unnecessarily 😊

#8

BoldMinded (Brian)

Yeah, I think it’s something with Publisher, but even the core stuff seems a little odd to me, as in with my testing, if I’m not logged in and not using Publisher there appears to be no way to for that relative date stuff to use the German translation, it just defaults to loading English, so I’m not sure what the intention is with EE itself or if that is a bug within EE.

#9

BoldMinded (Brian)

I worked with Robin on this and sent her a new build that should fix it, and I think she is uploading it and testing it on your dev site.

#10

BoldMinded (Brian)

Matthias, I’m going to go ahead and close this b/c Robin said the issue appears fixed with the build I sent her, which she put on your server. I’m glad this was an easy fix and we could get it sorted out for you pretty quickly!

Login to reply