Project

General

Profile

Bug #4511

get_lang() doesn't manage well empty translations

Added by Yannick Warnier over 7 years ago. Updated over 7 years ago.

Status:
Bug resolved
Priority:
Normal
Assignee:
Category:
-
Target version:
Start date:
23/03/2012
Due date:
% Done:

100%

Estimated time:
1.00 h
Spent time:
Complexity:
Challenging
SCRUM pts - complexity:
?

Description

Many problems with incomplete languages have been spotted (mainly in Dutch, as this was extracted from a Dutch training).

The normal behaviour of the get_lang() function is to load the English language strings (always defined), then load the current language (in this case Dutch).

If a language string hasn't ben defined in Dutch, then get_lang() detects it and falls back on the English translation.

This used to work in the past (two years ago), but apparently the move to the translation management system we have now has caused a problem: while the untranslated strings were ignored (i.e. not included in the exported language files) by the previous system, now they are exported as empty strings:

$LangVar = '';

This causes get_lang() to think that the translation exists, and fill it with an empty string, which is causing missing labels and links all over Chamilo.

There are two ways to solve this:

  • update get_lang() to ensure it checks first whether a string is empty (this would be using a lot of resources and might already be covered by a change of translation system)
  • update the current translation system so that it doesn't include empty strings (this would be the best solution, because it would only impact the load when generating the translation files, not when any user in the world shows a Chamilo page)

This task might be deprecated if we move to gettext. Please let me know what the status is regarding gettext


Files

noemptyvars.patch (932 Bytes) noemptyvars.patch Bas Wijnen, 23/03/2012 19:04
get_lang.png (13.8 KB) get_lang.png Julio Montoya, 06/04/2012 11:23

Related issues

Related to Chamilo LMS - Feature #4467: Add gettext supportNeeds more info11/03/2012

Actions

History

#1

Updated by Bas Wijnen over 7 years ago

I've written a patch for this a long time ago. I thought I had already posted it here, but appearantly not. I've attached it now. It implements the first solution. I agree that the second solution is better, but something had to be done; the system was quite unusable with all the missing translations (in Dutch). I think I've translated most of them (or even all) as well, but I think I already sent them. Are there still many missing, or are they new strings?

#2

Updated by Julio Montoya over 7 years ago

  • File get_lang.png get_lang.png added
  • Status changed from Assigned to Needs more info
  • Assignee changed from Julio Montoya to Yannick Warnier

I think that patch was already been applied,

I can't reproduced the error: I created a new course in dutch and change my system default language to dutch and it seems fine, I have english terms in my dutch installation:

#3

Updated by Yannick Warnier over 7 years ago

Bas Wijnen wrote:

I've written a patch for this a long time ago. I thought I had already posted it here, but appearantly not. I've attached it now. It implements the first solution. I agree that the second solution is better, but something had to be done; the system was quite unusable with all the missing translations (in Dutch). I think I've translated most of them (or even all) as well, but I think I already sent them. Are there still many missing, or are they new strings?

The patch you attached fixes the surrounding quotes, but it doesn't prevent the problem of empty translations.

Julio, leave it on feedback assigned to me, I will make the relevant tests later on.

#4

Updated by Yannick Warnier over 7 years ago

  • Complexity changed from Easy to Challenging
#5

Updated by Yannick Warnier over 7 years ago

  • Status changed from Needs more info to Bug resolved
  • Assignee changed from Yannick Warnier to Bas Wijnen
  • % Done changed from 50 to 100

OK, the problem with empty vars is definitely fixed. There is some kind of side-effect caused by the change of languages and the static language variables or some kind of caching: when changing the language, we have sometimes the names of the variables showing, and sometimes we have the [= =] showing although the "hide markup" is set (but I just checked and this is due to the "test server mode" setting).

I think it's alright then. Closing. Thanks guys.

Also available in: Atom PDF