Now the plugin can load the new locale (sn_BR), in which the locale files are included into the plugin folder. The new locale also is displayed on the UI, and can be toggle on/off as usual.
The only point that needed modification directly on OJS, was the need to create a symbolic link between the OJS “/locale/sn_BR” directory to the plugin folder where the locales are loaded.
This point is only necessary because of some validation made on locales, by the PKPLocale::isLocaleValid method, which checks for the existence of the “/locale/sn_BR” directory. If there is no folder there, the locale is not loaded, even if the locale files are in fact loaded by our plugin, triggered by a hook.
It would be perfect if it was not necessary to create the symbolic link. Any ideas?
I guess pkplib ought to have a hook PKPLocale::isLocaleValid that is evaluated in the function of that same name and allows to short-circuit the normal logic, so that a plugin can insert its own test instead: If the plugin knows it can load that locale, the callback returns true for isLocaleValid; if it does not, it defers the evaluation to the ordinary implementation of PKPLocale::isLocaleValid.
I think this restriction might have gone away with OJS/OMP/OPS 3.4.0: it is no longer necessary for OJS to include a translation of a locale for Locale::isLocaleValid to accept it as valid. Now it only needs to pass a regular expression:
Public Knowledge Project Team