org.formaria.editor.langed
Class LangManager

java.lang.Object
  extended by org.formaria.editor.langed.LangManager

public class LangManager
extends java.lang.Object

LangManager

Copyright (c) Formaria Ltd., 2001-2006, This software is licensed under the GNU Public License (GPL), please see license.txt for more details. If you make commercial use of this software you must purchase a commercial license from Formaria.

$Revision: 1.7 $


Constructor Summary
LangManager(boolean _bIsStandalone)
           
 
Method Summary
 java.lang.String getLangName()
           
 int getNumStrings()
          Gets the number of strings in the current language.
 java.lang.String getString(int id)
          Gets a string from the language.
 java.lang.String getSubString(int id)
          Gets a string from the language, calls getString.
 java.lang.String getSubString(java.lang.String substitution)
          Gets a string from the language, calls getString.
 void read(java.lang.String driver, java.lang.String url, java.lang.String userName, java.lang.String password, java.lang.String code, java.lang.String tableName, boolean doSubstitutions)
          Deprecated. uses an old file format public void read( String code ) throws IOException { currentLang = new Language(); String file = url.toString(); String fs = System.getProperty( "file.separator" ); int index = file.lastIndexOf( fs ); if ( index == -1 ) { index = file.lastIndexOf( "/" ); if ( index == -1 ) index = file.lastIndexOf( "\\" ); } file = file.substring( 0, index + 1 ); code += ".jln"; BufferedReader is; //file += "lang/"; file += code; URL url2 = new URL( file ); is = new BufferedReader( new InputStreamReader( url2.openStream())); currentLang.read( is, false ); is.close(); // Read the substrings if ( index == -1 ) { index = file.lastIndexOf( "/" ); if ( index == -1 ) index = file.lastIndexOf( "\\" ); } file = file.substring( 0, index + 1 ); file += "sub.jln"; URL url3 = new URL( file ); is = new BufferedReader( new InputStreamReader( url3.openStream())); subStrings.read( is, true ); is.close(); }
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LangManager

public LangManager(boolean _bIsStandalone)
Method Detail

read

public void read(java.lang.String driver,
                 java.lang.String url,
                 java.lang.String userName,
                 java.lang.String password,
                 java.lang.String code,
                 java.lang.String tableName,
                 boolean doSubstitutions)
Deprecated. uses an old file format public void read( String code ) throws IOException { currentLang = new Language(); String file = url.toString(); String fs = System.getProperty( "file.separator" ); int index = file.lastIndexOf( fs ); if ( index == -1 ) { index = file.lastIndexOf( "/" ); if ( index == -1 ) index = file.lastIndexOf( "\\" ); } file = file.substring( 0, index + 1 ); code += ".jln"; BufferedReader is; //file += "lang/"; file += code; URL url2 = new URL( file ); is = new BufferedReader( new InputStreamReader( url2.openStream())); currentLang.read( is, false ); is.close(); // Read the substrings if ( index == -1 ) { index = file.lastIndexOf( "/" ); if ( index == -1 ) index = file.lastIndexOf( "\\" ); } file = file.substring( 0, index + 1 ); file += "sub.jln"; URL url3 = new URL( file ); is = new BufferedReader( new InputStreamReader( url3.openStream())); subStrings.read( is, true ); is.close(); }


getString

public java.lang.String getString(int id)
Gets a string from the language.

Parameters:
id - the ID of the requird string.
Returns:
the requested string complete with substitutions or else "" if not found.

getNumStrings

public int getNumStrings()
Gets the number of strings in the current language.


getSubString

public java.lang.String getSubString(int id)
Gets a string from the language, calls getString.

Parameters:
id - the ID of the required string.
Returns:
the requested string complete with substitutions or else "" if not found.

getSubString

public java.lang.String getSubString(java.lang.String substitution)
Gets a string from the language, calls getString.

Parameters:
subString - the substitution string.
Returns:
the requested string from the current language.

getLangName

public java.lang.String getLangName()