org.formaria.editor.langed
Class EdLangMgr

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

public class EdLangMgr
extends java.lang.Object

LangManager manages the language resources on behalf of the language editor.

Copyright: Formaria Ltd. (c) 2001-2006. This software is licensed under the GNU Public License (GPL) see license.txt for more details on licensing


Constructor Summary
EdLangMgr(boolean _bIsStandalone, java.net.URL _url)
           
 
Method Summary
 void addLang(java.lang.String code, java.lang.String name, java.lang.String encoding, boolean useDb)
          Adds a new language This function is intended primarily for internal use by the catalogue viewer.
 void exportExcel(java.io.File theFile, java.lang.String[] selectedLangs)
          Export content to an excel file based language resource.
 void exportFile(java.io.File theFile, char delimiterStartChar, char delimiterEndChar, java.lang.String[] selectedLangs)
          Export content to a file based language resource
 EdLanguage getCurrentLang()
          Returns the current language...
 java.lang.String getKey(int id)
          Gets the key corresponding to an ID
 EdLanguage getLang(int index)
          Loads a language and sets it as the default language.
 EdLanguage getLang(java.lang.String langName)
          Loads a language and sets it as the default language.
 java.lang.String getLangCode(int index)
          Returns the name of the indexed language
 EdLanguage getLangFromList(int index)
          Returns a language from the specified index in the list.
 java.lang.String getLangName(int index)
          Returns the name of the indexed language
 int getNumLangs()
          Returns the number of languages
 java.lang.String getProjectPath()
           
 boolean hasLang(java.lang.String code)
           
 void importExcel(java.awt.Component parent, java.io.File theFile)
          Import content to an excel file based language resource.
 void importFile(javax.swing.JPanel parent, java.io.File theFile)
           
 org.formaria.editor.langed.EdLangName importPropertiesFile(java.io.File theFile, java.lang.String code, java.lang.String name)
           
 void init(java.net.URL _url)
           
 void init(java.util.Vector languages, java.util.Vector translations)
           
 boolean isLoadedFromExportedFiles()
           
 void newFile()
           
 void saveFile(char delimiterStartChar, char delimiterEndChar)
           
 void setCurrentLang(java.lang.String langName)
           
 void setId(java.lang.String id)
           
 void setProjectPath(java.lang.String pp)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EdLangMgr

public EdLangMgr(boolean _bIsStandalone,
                 java.net.URL _url)
Method Detail

init

public void init(java.net.URL _url)
          throws java.io.IOException
Throws:
java.io.IOException

getProjectPath

public java.lang.String getProjectPath()

setProjectPath

public void setProjectPath(java.lang.String pp)

init

public void init(java.util.Vector languages,
                 java.util.Vector translations)
          throws java.io.IOException
Throws:
java.io.IOException

importPropertiesFile

public org.formaria.editor.langed.EdLangName importPropertiesFile(java.io.File theFile,
                                                                  java.lang.String code,
                                                                  java.lang.String name)
                                                           throws java.io.IOException
Throws:
java.io.IOException

hasLang

public boolean hasLang(java.lang.String code)

importFile

public void importFile(javax.swing.JPanel parent,
                       java.io.File theFile)
                throws java.io.IOException
Throws:
java.io.IOException

exportFile

public void exportFile(java.io.File theFile,
                       char delimiterStartChar,
                       char delimiterEndChar,
                       java.lang.String[] selectedLangs)
                throws java.io.IOException
Export content to a file based language resource

Parameters:
theFile -
selectedLangs - the list of languages to export
Throws:
java.io.IOException

exportExcel

public void exportExcel(java.io.File theFile,
                        java.lang.String[] selectedLangs)
                 throws java.io.IOException
Export content to an excel file based language resource. This assumes that the first language exported is the master language containing all the keys

Parameters:
theFile -
selectedLangs - the list of languages to export
Throws:
java.io.IOException

importExcel

public void importExcel(java.awt.Component parent,
                        java.io.File theFile)
                 throws java.io.IOException
Import content to an excel file based language resource. This assumes that the first language exported is the master language containing all the keys

Parameters:
theFile -
selectedLangs - the list of languages to export
Throws:
java.io.IOException

isLoadedFromExportedFiles

public boolean isLoadedFromExportedFiles()

addLang

public void addLang(java.lang.String code,
                    java.lang.String name,
                    java.lang.String encoding,
                    boolean useDb)
Adds a new language This function is intended primarily for internal use by the catalogue viewer.

Parameters:
code - The ISO code for a locale.
name - A plain text name for the language in the national language.

getLangFromList

public EdLanguage getLangFromList(int index)
Returns a language from the specified index in the list.

Parameters:
index - int specifing the index
Returns:
the returned EdLanguage instance

getLang

public EdLanguage getLang(int index)
Loads a language and sets it as the default language. This function is intended primarily for internal use by the catalogue viewer.

Parameters:
index - the index for the language.

getLang

public EdLanguage getLang(java.lang.String langName)
Loads a language and sets it as the default language. This function is intended primarily for internal use by the catalogue viewer.

Parameters:
index - the index for the language.

getCurrentLang

public EdLanguage getCurrentLang()
Returns the current language... the comments language


getKey

public java.lang.String getKey(int id)
Gets the key corresponding to an ID

Parameters:
id -
Returns:

setId

public void setId(java.lang.String id)

getNumLangs

public int getNumLangs()
Returns the number of languages


getLangName

public java.lang.String getLangName(int index)
Returns the name of the indexed language


getLangCode

public java.lang.String getLangCode(int index)
Returns the name of the indexed language


setCurrentLang

public void setCurrentLang(java.lang.String langName)

saveFile

public void saveFile(char delimiterStartChar,
                     char delimiterEndChar)

newFile

public void newFile()