Language files

Anonymous
2010-11-19
2013-06-03
  • Anonymous - 2010-11-19

    How are language files maintained and updated? Would it be an idea to make a database with web interface? That way new strings could be added automatically to all languages, and it's easy to see what strings that need to be translated.

     
  • nabber00

    nabber00 - 2010-11-20

    Yes the language files are a little disorderly.  We should probably migrate it to gettext since PHP has built in support for that.  Maybe I can whip up something to help in the meantime.

     
  • Anonymous - 2010-11-22

    I think sphpb has a design problem here  - maybe gettext will fix this. The problem is there's no fallback if a string doesn't exsist in a language file. A code line like this

    <input type="submit" name="submit" value="<?php echo( $GLOBALS ); ?>" />

    will make a button with no text, if the language file is not up to date. And I am sure you can find more critical examples.

    Also, the approach where we're only loading the strings related to the actual page is smart, but it is not smart to use identical names for strings, just because you can. For example:

        switch ($page) {

          case 'add':

            // Add Entry

            $lang_string = "";

    Here, the name could be 'add_title' instead, 'comments_title' for comments.php, etc. It's not a problem now, but it could be in the future, and it open up for possible bugs. Making names uniqe is more safe. Well, it's just a suggestion.

     
  • nabber00

    nabber00 - 2010-11-23

    Yes gettext will fix that so a fallback exists.  The way it works is the English (or default language) is used in the source code.  You can generate a language file using gettext tools with the English text as the key.  The only problem is when you change the English text, you need to change the language files to match.

    Also I'm not a fan of having to indicate the page to use the language strings. This prevents doing a simple 'include(mylanguage.php);' statement in a common header file, you still need to specify each page.   And you are right that the names should be globally unique.

     

Log in to post a comment.