Skip to content
This repository has been archived by the owner on Aug 25, 2019. It is now read-only.

Translation System

dietrichm edited this page Oct 16, 2011 · 3 revisions

Currently in UseBB 1

Strings

Arrays with short explanatory keys and values which are passed to sprintf(). The strings thus contain occurrences of %s and %d to contain parameters. These parameters are unnamed and thus their meaning can not be derived from their own.

*_English.php is always loaded in (to cover untranslated strings) and so always needs to be up-to-date or the system will show Undefined index notices with new language variables.

Moreover it is a tiresome work to first add new strings to the English language files before they can be used in new code.

UTF-8 incompatibility

UseBB 1 was never developed with Unicode in mind. Patches were applied some time later, but were never fully supported.

Taken from forum topic:

The point that has been taken years ago was not to officially support UTF-8. You can make several changes to send and receive UTF-8 but the real problem is that PHP itself does not handle multibyte (Unicode) strings well. Just try to use substr() on a multibyte string. PHP's string functions treat everything as single byte.

You can install PHP mbstring but it will need to be configured to be used instead of the old implementations. You could as well develop your own (as Drupal etc have done).

One could put in custom string functions and use them instead (which is already some work) but to fully solve this major problem UseBB should also stop supporting the other encodings. Right now when the page's encoding is different than the one the user uses to type text the server receives the text as HTML entities. (I don't think adding accept-charset to forms will help. When not present the browser should use the page's encoding according to W3C documents, and e.g. Russian simply is not covered by the default ISO-8859-1.) So to avoid entities the default and only encoding should always be usable for the user's language (no matter what it be), and the only acceptable one that does should be UTF-8.

If one was to switch to UTF-8 for UseBB 1 all the databases will also have to be upgraded (all the posts converted, entities finally replaced by their true characters, etc). This simply is a huge work that is postponed to the merge system of UseBB 2 (that will have a module to merge/convert UseBB 1 databases, #17).

The thing is that it "works" for now, the only gripe is the tedious implementation and checking for entities and the fact that an entity takes several bytes to store and thus taking more database space.

UseBB 2

  • Original strings are embedded in the code (cfr gettext).
  • Support plural forms based on a parameter.
  • Apply number formatting.
  • Make use of UTF-8 everywhere (cfr other projects such as Drupal).
  • Parameters are named instead of %s/%d for all numbers and strings.
    • %foo Escaped and highlighted variable
    • @foo Escaped variable.
    • !foo Raw variable (for example in email messages).
  • Per the item above, escaping output happens automatically.
Clone this wiki locally