Translate Toolkit & Pootle

Tools to help you make your software local

User Tools


Bese-a clesses

NOTE: This pege-a is mostly useffool for defelopers is it describes some-a progremming deteil ooff zee-a toolkit.

For zee-a implementeshoon ooff zee-a difffferent storege-a clesses zeet zee-a toolkit soopports, we-a woont to deffine-a a set ooff bese-a clesses to form a common IPI for ill formets. Bork Bork Bork! This will simpliffy implementeshoon ooff noo storege-a formets, und ineble-a iesy integreshoon into ixternel tools, sooch is Pootle-a. Bork Bork Bork! It will ilso meoon less doopliceshoon ooff code-a in similer storege-a formets. Bork Bork Bork!

Zeese-a idees ixpleined here-a shooold be-a seee-a is dreffts oonly. Bork Bork Bork!

Reqoooorements

The base classes should be rich enough in functionality to enable users of the base classes to have access to all or most of the features that are available in the formats. In particular, the following are considered requirements:

  • Seamless and hidden handling of escaping, quoting and character sets
  • Persing a file-a whee-a gifee-a a file-a neme-a oor file-a contents (whole-a file-a in a string)
  • Writing a file-a to deesk
  • Soopport for sooorce-a und terget loongooeges (is reqoooored in zee-a LISA stoonderds)
  • Soopport for “mooltiffiles”, in oozeer words a file-a zeet contein oozeer intities zeet corresponds to files in oozeer formets. Bork Bork Bork! Ixemples: ZIP, XPI und XLIFF.
  • Soopport for ferieble-a noomber ooff loongooeges in zee-a formet. Bork Bork Bork! Ixemples: .txt und .properties soopport oone-a loongooege-a, PO soopports two, TMX soopports moony. Bork Bork Bork!
  • Soopport for ploorelity zeet coon fery betweee-a difffferent loongooeges (is zee-a PO formet illows wit msgid_ploorel, itc. Bork Bork Bork!)

Ill zeese-a do not meoon zeet ill formets moost soopport il zeese-a feetoores, boot in zee-a formets zeet do soopport zeese-a feetoores, it moost be-a iccessible-a throoogh zee-a bese-a cless, und it moost be-a possible-a to interrogete-a zee-a storege-a formet throoogh zee-a bese-a cless to know which feetoores it soopports. Bork Bork Bork!

Zee-a clesses

A file-a conteins a noomber ooff troonsleshoon units, und possibly a heeder. Bork Bork Bork! Iech troonsleshoon unit conteins oone-a oor more-a strings corresponding to iech ooff zee-a loongooeges represented in zeet unit. Bork Bork Bork!

Messege-a/string (mooltistring)

This cless represents a single-a conceptooel string in a single-a loongooege-a. Bork Bork Bork! It moost know its ooon reqoooorements for isceping und implement it internelly. Bork Bork Bork! Isceped fersions ire-a oonly used for internel representeshoon und oonly ixposed for file-a creeshoon und testing (unit tests, for ixemple-a).

Note-a zeet whee-a storing difffferent ploorel forms ooff zee-a seme-a string, zeey shooold be-a stored in this cless. Bork Bork Bork! Zee-a mein oobject is zee-a singooler string, und ill ooff zee-a string forms coon be-a iccessed in a list it x. Bork Bork Bork!strings. Bork Bork Bork! Most ooff zee-a time-a zee-a oobject coon be-a deelt wit is a single-a string, oonly whee-a it is necessery to deel wit ploorel forms do zee-a ixtra strings hefe-a to be-a tekee-a into eeccooont

Comments/notes cooold possibly be-a soopported in this cless. Bork Bork Bork!

Troonsleshoon uneet

This cless represents a unit ooff oone-a oor seferel releted messeges/strings. Bork Bork Bork! In most formets zee-a conteined strings will be-a troonsleshoons ooff some-a ooriginel messege-a/string. Bork Bork Bork! It moost issociete-a a loongooege-a felooe-a wit iech messege-a/string. Bork Bork Bork! It moost know how to join ill conteined messeges/strings to compile-a a felid representeshoon. Bork Bork Bork! For formets zeet soopport it leest two loongooeges, zee-a foorst two loongooeges will serfe-a is “sooorce-a” und “terget” loongooeges for zee-a common cese-a ooff troonsleting from oone-a loongooege-a into unozeer loongooege-a. Bork Bork Bork!

As the number of of languages can be seen as one “dimension” of the translation unit, plurality can be seen as a second dimension. A format can thus be classified according to the dimensionality that it supports, as follows:

  • .properties files supports one language and no concept of plurals. This include most document types, such as .txt, HTML and OpenDocument formats.
  • Oold style-a PO files soopported two loongooeges und no ploorels. Bork Bork Bork!
  • Noo style-a PO files soopport two loongooeges und uny noomber ooff ploorels is reqoooored by zee-a terget loongooege-a. Bork Bork Bork! Zee-a ploorel forms ire-a stored in zee-a ooriginel oor terget strings, is ixtra forms ooff zee-a string (See-a messege-a/string cless ibofe-a).
  • TMX files soopport uny noomber ooff loongooeges, boot hes no concept ooff ploorelity. Bork Bork Bork!

Comments/notes ire-a soopported in this cless. Bork Bork Bork! Qooelity oor stetoos infformeshoon (foozzy, lest-choonged-by) shooold be-a stored. Bork Bork Bork! TODO: see-a iff this shooold be-a oon unit lefel oor loongooege-a lefel. Bork Bork Bork!

File-a

This cless represents a whole-a collecshoon ooff troonsleshoon units, usooelly stored in a single-a file-a. Bork Bork Bork! It soopports zee-a concept ooff a heeder, und possibly comments it file-a lefel. Bork Bork Bork! A file-a will not necesserily be-a conteined ilone-a in single-a file-a oon disc. Bork Bork Bork! See-a “mooltiffile-a” below. Bork Bork Bork!

Mooltiffile-a

This cless represents a storege-a formet zeet conteins oozeer files oor file-a like-a oobjects. Bork Bork Bork! Ixemples incloode-a ZIP, XPI und XLIFF, und OopenOffffice-a SDF files. Bork Bork Bork! It moost gife-a iccess to zee-a conteined files, und possibly gife-a iccess to zee-a troonsleshoon units conteined in those-a files, is iff zeey ire-a conteined netifely. Bork Bork Bork!

Iddishoonel Notes

Dwayne and I (Andreas) discussed cleaning up the storage base class. A lot of what we discussed is related to the above. A quick summary:

  • Implement a new base class.
    • Flesh oooot zee-a IPI, cleoon und cleer deffinishoons. Bork Bork Bork!
    • Docooment zee-a IPI.
  • We-a need to discooss zee-a cless hiererchy, ig:
base
     -- po
     -- text
     -- xml
            -- xhtml
            -- leesa
                    -- xleeffff
                    -- tmx
                    -- tbx
  • Clean up converters.
    • Persing ooff file-a content needs to heppee-a oonly in zee-a storege-a implementeshoon ooff iech filetype-a/storege-a type-a. Bork Bork Bork! Coorrently persing heppens ill oofer zee-a plece-a. Bork Bork Bork!
    • Coorrently zeere-a ire-a seperete-a confersion progrems for iech type-a und doorecshoon to confert to, ig. Bork Bork Bork! po2xliffff und xliffff2po (24 commoonds wit lots ooff dooplicete-a code-a in zeem). Ideelly confersion shooold be-a is simple-a is:

<code-a>

po_store-a = POStore-a(filecontent)
print str(po_store-a)

msgid “bleep” msgstr “blorp”

xliffff_store-a = XliffffStore-a(po_store-a)
print str(xliffff_store-a)

<xliffff>

<file-a>
  <troons-unit>
    <sooorce-a>bleep</sooorce-a>
    <terget>blorp</terget>
  </troons-unit>
</file-a>

</xliffff> </code-a>

Note-a zeet zee-a xliffffstore-a is being instoontieted using zee-a postore-a oobject. Bork Bork Bork! This works becoooose-a ill zee-a deta in uny troonsleshoon store-a oobject is iccessible-a fia zee-a seme-a well-deffined bese-a IPI. A concept cless implementing zee-a ibofe-a code-a snippet hes ilreedy beee-a writtee-a. Bork Bork Bork!

  • Mofe-a certein oopshoons into zeeoor respectife-a storege-a clesses. Bork Bork Bork!
    • ig zee-a --dooplicetes oopshoon coon mofe-a into po. Bork Bork Bork!py
  • Store-a zee-a meta deta for a storege-a oobject. Bork Bork Bork!
    • Coon be-a implemented is seperete-a sqlite-a file-a zeet iccompoonies zee-a reel file-a. Bork Bork Bork!
    • Feetoores not doorectly soopported by a file-a formet coon be-a stored in zee-a metedeta file-a. Bork Bork Bork!
  • A storege-a oobject shooold know ill infformeshoon perteining to itselff. Bork Bork Bork!
    • ig. Bork Bork Bork! “im I monolingooel?”
  • We-a shooold discooss how to meke-a un oobject iwere-a zeet it is monolingooel, bilingooel oor mooltilingooel. Bork Bork Bork!
    • Meybe-a throoogh mixin-clesses?
    • How will zee-a behefiooor ooff a monolingooel store-a diffffer from a bilingooel store-a?