freeride-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [FR-devel] [Foxgui-users]Very alpha version of FR debugger in CVS


From: Horacio Lopez
Subject: RE: [FR-devel] [Foxgui-users]Very alpha version of FR debugger in CVS
Date: 30 Jul 2002 19:15:08 -0300

> 
> Curt
> I'd still like to get a rudimentary "gettext" like facility in there for
> internationalization, and we could use a help facility with minimal
> documentation.
> 

I got my hands on it...
I will release it ASAP !!

I am designing it so that you can use different 
text databases, and you don't have to deal
with the gettext innards yourself.


I'm still trying to decide what gettext module is 
the best for our purposes.
For now I will try to provide something
as rubiesque as I can.

# Opening a language resource database:
# -------------------------------------
langdb = LanguageRepository.new("gettext","./langdb/freeride.po")

langdb = LanguageRepository.new("xml", "./langdb/freeride.xml")

langdb = LanguageRepository.new("dbi", "mysql:freeride" )

langdb = LanguageRepository.new("gdb","./langdb/freeride.gdb")
 
# Once you open a language resource database
# you can retrieve a language set for your application
# In the case of file-based systems like gettext .pos
# -----------------------------------------------------
L = langdb.Language("myapp")
L.select("en-us");
puts L?"PRESS_ANY_KEY"

# you also could do things like:
mybutton.setlabel( L?"DELETE" )

# search text in the language database using
# euc-kr korean encoding, but retrieve text from
# the database as utf-8 strings
L.SetEncodingInput("euc-kr")  
L.SetEncodingOutput("utf-8")  

# Inserting a new language string

L.store("es-sp", "HELLO", "Hola" )
L.commit


# moving strings from one database to another
gt_len_db = LanguageRepository.new("gettext","./langdb/freeride_en.po")
gt_lsp_db = LanguageRepository.new("gettext","./langdb/freeride_sp.po")

xml_outdb = LanguageRepository.new("xml","./langdb/freeride.xml")

E = gt_len_db.Language("myapp")
S = gt_lsp_db.Language("myapp")

S.SetCharsetInput("iso-8859-1")
S.SetCharsetOutput("iso-8859-1")

E.SetCharsetInput("us-ascii")
E.SetCharsetOutput("us-ascii")

O = xml_outb.Language("myapp")
O.SetCharset("iso-8859-1","iso-8859-1")
O << "es-sp"

O.store( E?"TEXT_PRESS_ANY_KEY" )
O.store( E?"BUTTON_HELP" )
O.store( E?"BUTTON_DELETE" )
O.store( E?"MENUOPTION_FILE" )
O.store( E?"MENUOPTION_EXIT" )

O.select("es-sp")
O.store( S?"TEXT_PRESS_ANY_KEY" )
O.store( S?"BUTTON_HELP" )
O.store( S?"BUTTON_DELETE" )
O.store( S?"MENUOPTION_FILE" )
O.store( S?"MENUOPTION_EXIT" )

O.commit

# Now the text is retrieved form the XML database
puts O?"TEXT_PRESS_ANY_KEY"

# You don't know the hash key, but you know
# how to spell it in your language:
O << "en-us"
O >> "es-sp"
# output in spanish -->  Pulse una tecla
puts O("Press any key")

# Translating a text file
f = File.open("mykeys.txt")
f.each do |line|
  print O(line)
end
f.close


-----------------------------------------------

FreeBASE should have its own database, the same way
separate plug-ins should have separate ones too.

Work ahead:
* define standards for database storage
  + DTD for XML databases
  + SQL schema for rdbms based databases

* stabilize api


maybe you have better ideas, or suggest a different syntax
that's what's in the works right now.

after I got this, I will create a visual plug-in
that can:

* show the contents of a language repository

* edit its contents

* extract strings in the form L?"text" from
  ruby source code, and generate a language database
  from it.

Alternatively, we could use the language repositories
for storage of help files too

Quirks ? Misconceptions ?  Awful code ?
Please let me know what you don't like
it's still early enough to redesign.

I know I've been slow , damn too slow
code and documentation SOON, SOON, SOON

cheers

vruz





reply via email to

[Prev in Thread] Current Thread [Next in Thread]