Normal ?÷ REM ======================================================================================================================= REM === The ScriptForge library and its associated libraries are part of the LibreOffice project. === REM === Full documentation is available on https://help.libreoffice.org/ === REM ======================================================================================================================= Option Compatible Option ClassModule 'Option Private Module Option Explicit ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ''' L10N (aka SF_L10N) ''' ==== ''' Implementation of a Basic class for providing a number of services ''' related to the translation of user interfaces into a huge number of languages ''' with a minimal impact on the program code itself ''' ''' The design choices of this module are based on so-called PO-files ''' PO-files (portable object files) have long been promoted in the free software industry ''' as a mean of providing multilingual UIs. This is accomplished through the use of human-readable ''' text files with a well defined structure that specifies, for any given language, ''' the source language string and the localized string ''' ''' To read more about the PO format and its ecosystem of associated toolsets: ''' https://www.gnu.org/software/gettext/manual/html_node/PO-Files.html#PO-Files ''' and, IMHO, a very good tutorial: ''' http://pology.nedohodnik.net/doc/user/en_US/ch-about.html ''' ''' The main advantage of the PO format is the complete dissociation between the two ''' very different profiles, i.e. the programmer and the translator(s). ''' Being independent text files, one per language to support, the programmer may give away ''' pristine PO template files (known as POT-files) for a translator to process. ''' ''' This class implements mainly 4 mechanisms: ''' 1. AddText: for the programmer to build a set of words or sentences ''' meant for being translated later ''' 2. AddTextsFromDialog: to automatically execute AddText() on each fixed text of a dialog ''' 3. ExportToPOTFile: All the above texts are exported into a pristine POT-file ''' 4. GetText: At runtime get the text in the user language ''' Note that the first two are optional: POT and PO-files may be built with a simple text editor ''' ''' Several instances of the L10N class may coexist ' The constraint however is that each instance should find its PO-files ''' in a separate directory ''' PO-files must be named with the targeted locale: f.i. "en-US.po" or "fr-BE.po" ''' ''' Service invocation syntax ''' CreateScriptService("L10N"[, FolderName[, Locale]]) ''' FolderName: the folder containing the PO-files (in SF_FileSystem.FileNaming notation) '