Load a new locale with a plugin

Hi all,

I’m developing a plugin to translate text to SignWriting. The plugin needs to load a new locale, that is not distributed with OJS. It also uses JavaScript for the SignWriting translation.

The locale is site wide, a new language, like pt_BR, en_EN, not restricted to the plugin itself.

Is there a way to do that using the plugin, without modifications into the OJS instance? (include the locale on registry/locales.xml, and put locale files on /locales and /lib/pkp/locales)

target version: 3.3.0.1

Had some progress using a combination of dynamic locale loading, based on the custom locale plugin, and adding the new locale directly on the locales list cache.

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?