Debug: Howto show variables used in Chamilo 1.8.7 translations

As a developer or translator for Chamilo 1.8.*, you might often be faced with the need to know what variable is used to look for a translated term to be shown on screen. While we don’t have a nice in-house feature for this just yet, you can easily hack your own. Here’s how:

  • Go to main/inc/lib/internationalization.lib.php
  • Find the function get_lang
  • Find the first and the third “return” statements
  • Put the whole value (after the equal sign) between parenthesis and prefix them with: $variable.’-‘. (this should give something like  return $cache[$language][$variable] = $variable.’-‘.($_api_is_translated ? ($is_utf8_encoding ? $langvar : api_utf8_decode($langvar, $encoding)) : $langvar); )

From then, you should see all the variables show before the translated term. You can then go on http://translate.chamilo.org, click on “Advanced search” and change the translation to the right one.

It's only fair to share...Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedInShare on TumblrEmail this to someone

Leave a Reply

Your email address will not be published. Required fields are marked *