Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Question on languages and extensions

Extensions add their own terminology and language strings to Vanilla, e.g.for the Discussion overview extension: $Context->Dictionary['DiscussionOverview'] = 'Discussion Overview'; $Context->Dictionary['DiscussionOverviewAsTab'] = 'Show discussion overview in a separate tab'; I translated those strings and put them in the languages/Dutch/definitions.php file: $Context->Dictionary['DiscussionOverview'] = 'Discussie Overzicht'; $Context->Dictionary['DiscussionOverviewAsTab'] = 'Toon het discussie Overzicht in een aparte tab'; However, the translation was not shown. So I translated the phrases in the extension/<extension_name>/default.php file in-place, but I'm wondering: is this the way it should go? Or is there a way to keep language versions separate for extensions as well?


  • Options
    This comment describe the way I keep translations in the same dir as extensions while in separate files.
  • Options
    edited March 2007
    The example that pascalvanhecke gives doesn't work because extensions are included after the language files. The dictionary entries in the language files are getting clobbered by the settings in the extension. What would work instead is if the extension author had done something like this:
    if (!array_key_exists('DiscussionOverview', $Context->Dictionary) { $Context->Dictionary['DiscussionOverview'] = 'Discussion Overview'; } if (!array_key_exists('DiscussionOverviewAsTab', $Context->Dictionary) { $Context->Dictionary['DiscussionOverviewAsTab'] = 'Show discussion overview in a separate tab'; }
    Or even this:
    $ExtensionDict = array(); $ExtensionDict['DiscussionOverview'] = 'Discussion Overview'; $ExtensionDict['DiscussionOverviewAsTab'] = 'Show discussion overview in a separate tab'; $Context->Dictionary = array_merge($ExtensionDict, $Context->Dictionary);
    But neither of these feels all that elegant. My questions are: 1. Is there a better way that I've missed? and 2. Is there a consensus on what is the "right way" to do this?
  • Options
    edited March 2007
    Extensions should use $Context->SetDefinition('DiscussionOverview', 'Discussion Overview');It only set a default definition, it won't overwrite definitions from definitions.php or conf/language.php
  • Options
    Yep, I came across that recently and added that to the docs:
This discussion has been closed.