Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Try Vanilla Forums Cloud product
Vanilla 2.6 is here! It includes security fixes and requires PHP 7.0. We have therefore ALSO released Vanilla 2.5.2 with security patches if you are still on PHP 5.6 to give you additional time to upgrade.

Localization

ddumontddumont ✭✭
edited November 2011 in Development
@Todd I reported a bug about localization earlier today, turned out to be my mistake... but it does raise a few issues about current localization in Vanilla.

Here's what I'm trying to do:
I am building some integration of my Android app into my forum. Part of this involves plugins to extend the user profile and a theme with some minor tweaks to the default theme.

Now I am noticing that a few string resources are not quite right. I would rather not have my changes overridden on upgrade so I went about this by making a new locale. The only problem is locales in Vanilla do not behave the way they do in most places I've used them.

I looked around for an analog to the resource bundles we have in java and found this:
http://php.net/manual/en/class.resourcebundle.php

The way I expected things to work was that you guys would provide a default resource bundle. Then based on user settings or browser language, you would build a resource bundle for the locale. http://userguide.icu-project.org/locale/resources has some good info on how they work.

So without any extra resources, just providing default strings (virgin install of vanilla) a ResourceBundle for 'pt_BR' would still serve all of the default strings.

I've not fully investigated the i18n implementation in Vanilla, but I was kinda confused when starting to build my locale. I wasn't expecting to need to create a locale for each supported language... and then name and version it. I expected it to behave more like a resource bundle.

I also tried overriding the text for the TOS link in the signup page by just using my plugin, and it didn't work out so well...
Can you guys comment on the implementation of the locales in Vanilla and if you might consider moving to the ResourceBundle model I linked?

How would you suggest I safely override certain translatable strings without having to create my own locale (which would seemingly involve me having to copy the existing one as a starting point)?
I'd rather not have to do that, as I'd like to continue to get changes from you through upgrades while changing certain resources to fit my forum better.

My addons: NillaBlog | Vanoogle

reasey

Comments

  • ToddTodd Chief Product Officer Vanilla Staff
    This is something that could be better. What I recommend doing is this:

    1. Put your translations into a locale pack.
    2. If you are writing in English then leave the locale of your locale pack as 'en-CA'.
    3. When you enable your locale pack all of the default translations will be loaded first and then yours will override them.

    You can read more about localization here.
  • Ahh ok. So if I provide the same locale as the default defined locale, then my changes will be overrides rather than replacing the existing locale?

    I did read that link, what I'm concerned about is that I have translations for my app in Portuguese, German, French, and a few others. The locale system here looks like I'll have to include 4 or so different locales (and fully translate vanilla for the non en-CA ones).

    Will those 4-5 locales, once activiated on the forum, key off of the accept language of the user's browser?

    My addons: NillaBlog | Vanoogle

  • Also, what are the rules behind what plugins can contribute to the locale?

    My addons: NillaBlog | Vanoogle

Sign In or Register to comment.