Ticket #224 (closed defect: fixed)
Translation: Use default catalog if string not found in plugin catalog
| Reported by: | Paul Baranowski <paul@…> | Owned by: | gogo |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | Xinha Core | Version: | |
| Severity: | normal | Keywords: | |
| Cc: |
Description
If a string is not found in the plugin language catalog, then we should check the main ("HTMLArea") catalog to see if the string exists there. That way, we arent duplicating strings in the plugin language catalog. Also, this still gives the plugin strings preference in case the plugin needs to override a string in the main language catalog.
Here is the new code for HTMLArea._lc() :
/** Return a localised string.
* @param string English language string
* @param context Case sensitive context name, eg 'HTMLArea' (default), 'TableOperations'...
*/
HTMLArea._lc = function(string, context)
{
if(_editor_lang == "en")
{
return string;
}
if(typeof HTMLArea._lc_catalog == 'undefined')
{
HTMLArea._lc_catalog = [ ];
}
if(typeof context == 'undefined')
{
context = 'HTMLArea';
}
if(typeof HTMLArea._lc_catalog[context] == 'undefined')
{
HTMLArea._lc_catalog[context] = HTMLArea._loadlang(context);
}
if(typeof HTMLArea._lc_catalog[context][string] == 'undefined')
{
// If we are looking at a plugin language file,
// we now check to see if the string is in the
// main translation file so as not to duplicate translation strings.
if (context != 'HTMLArea') {
// Load the main language file if it isnt loaded already.
if(typeof HTMLArea._lc_catalog['HTMLArea'] == 'undefined')
{
HTMLArea._lc_catalog['HTMLArea'] = HTMLArea._loadlang('HTMLArea');
}
// Look for the string in the main language file
if(typeof HTMLArea._lc_catalog['HTMLArea'][string] != 'undefined')
{
return HTMLArea._lc_catalog['HTMLArea'][string];
}
}
return string; // Indicate it's untranslated
}
else
{
return HTMLArea._lc_catalog[context][string];
}
}
Change History
Note: See
TracTickets for help on using
tickets.
