YaBB3::Language - The Language Class


Name

YaBB3::Language - The Language Class


Synopsis

  use YaBB3::Language;
  $Y->{TXT} = new YaBB3::Language;
  $Y->{TXT}->init;      # initializes and loads the COMMON language file for the currently selected language
        
  my $cancelText = $Y->{TXT}->{COMMON}->{'CANCEL_BTN'};
        
  $Y->{TXT}->load( 'ADMIN'); # loads the language file ADMIN.
  my $adminWelcomeText = $Y->{TXT}->{ADMIN_TXT}->{'WELCOME'};


Overview

Class which provides multilanguage support.


Description

This class only provides the required methods to initialize and load language files but also text manipulation methods.

The strings which are depending on the users language are saved as a set of hashs for every language (as far as the translations are available). For each language we have one folder. The strings for a language are splitted into several files depending on the usage in all the other packages.

YaBB 3 is saving the language strings into the global variable $Y so they are always available and won't be loaded twice.


Reference

A bunch of language files...

Use Packages

require Packages

All language files which we can and want to load...

Exports

  Default   $VERSION
  Optional
  Tags

Package Fields

  $VERSION  The package version number as a float.

Package Subroutines

Object Super Classes

  YaBB3::BaseHash

Class Methods

Object Fields

%{$lngfile}

Object Methods

init

Initialize the object, set the YaBB version string and load the COMMON language file.

load

    $lngfile     The language file to load

Load an additional language file to $self->{$lngfile}. if it already exists it returns with true directly.

show

    $lngfile     A language file
    $txt         The key which references the text to return
    /@vars       An array of variables which replaces the placeholder in the text

Returns a specified text and replaces the placeholders by the values of the passed variables in @vars. Useful for text with placeholders, only. It expects that the required language file has been loaded by the load-method, before.


ToDo

Get the current selected language from the database. Currently it loads english language files, only.


Author

Torsten Mrotz (tmrotz@yabbforum.com)

Copyright ©2000-2005, YaBB 3 Development Team. All Rights Reserved.
You may distribute this module under the terms of YaBB 3.
 YaBB3::Language - The Language Class