Code to convert between different storage formats for localizations.
functions used to manipulate access keys in strings
Helper to mix separately defined labels and accesskeys into one unit.
Populates mixedentities from the index.
Mix the given units into the given target_unit if possible.
Might return None if no match is possible.
Combine a label and and accesskey to form a label+accesskey string
We place an accesskey marker before the accesskey in the label and this creates a string with the two combined e.g. “File” + “F” = “&File”
The case of the accesskey is preferred unless no match is found, in which case the alternate case is used.
Parameters: |
|
---|---|
Return type: | unicode or None |
Returns: | label+accesskey string or None if uncombineable |
Extract the label and accesskey from a label+accesskey string
The function will also try to ignore &entities; which would obviously not contain accesskeys.
Parameters: |
|
---|
Handles converting of files between formats (used by translate.convert tools).
ConvertOptionParser that can handle recursing into single archive files.
archiveformats maps extension to class. If the extension doesn’t matter, it can be None.
If the extension is only valid for input/output/template, it can be given as (extension, filepurpose).
Adds an option to say what to do with duplicate strings.
Adds an option to include / exclude fuzzy translations.
Adds an option to say how to split the po/pot files.
add_option(opt_str, ..., kwarg=val, ...)
Adds an option to output only stores where translation percentage exceeds the threshold.
-> (values : Values, args : [string])
Check that the supplied option values and leftover arguments are valid. Returns the option values and leftover arguments (possibly adjusted, possibly completely new – whatever you like). Default implementation just returns the passed-in values; subclasses may override as desired.
Checks to see if subdir under options.output needs to be created, creates if neccessary.
Defines the given option, replacing an existing one of the same short name if neccessary...
Declare that you are done with this OptionParser. This cleans up reference cycles so the OptionParser (and all objects referenced by it) can be garbage-collected promptly. After calling destroy(), the OptionParser is unusable.
Set parsing to stop on the first non-option. Use this if you have a command processor which runs another command that has options of its own and you want to make sure these options don’t get confused.
Set parsing to not stop on the first non-option, allowing interspersing switches with command arguments. This is the default behavior. See also disable_interspersed_args() and the class documentation description of the attribute allow_interspersed_args.
Print a usage message incorporating ‘msg’ to stderr and exit. If you override this in a subclass, it should not return – it should either exit or raise an exception.
Filters input formats, processing relevant switches in options.
Filters output options, processing relevant switches in options.
Write the temp outputfile to its final destination.
returns a formatted manpage
Returns the archiveclass for the given fileext and filepurpose
Make a nice help string for describing formats...
Gets the absolute path to an input file.
Gets the absolute path to an output file.
Gets the absolute path to a template file.
Gets an output filename based on the input filename.
Works out which output format and processor method to use...
Get the options required to pass to the filtermethod...
Gets an output filename based on the input filename.
returns the usage string for the given option
returns the usage string for the given option
Creates an outputarchive if required.
Sets up a progress bar appropriate to the options and files.
Opens the templatearchive if not already open.
Returns whether the file option is an archive file.
Checks if this path has been excluded.
Checks if fileoption is a recursive file.
Checks if this is a valid input filename.
Makes a subdirectory (recursively if neccessary).
Creates an archive object for the given file.
Opens the input file.
Opens the output file.
Opens the template file (if required).
Opens a temporary output file.
Parses the command line options, handling implicit input/output args.
Converts a .po to a .pot where required.
Print an extended help message, listing all options and any help text provided with them, to ‘file’ (default stdout).
outputs a manpage for the program using the help information
Print the usage message for the current program (self.usage) to ‘file’ (default stdout). Any occurrence of the string “%prog” in self.usage is replaced with the name of the current program (basename of sys.argv[0]). Does nothing if self.usage is empty or not defined.
Print the version message for this program (self.version) to ‘file’ (default stdout). As with print_usage(), any occurrence of “%prog” in self.version is replaced by the current program’s name. Does nothing if self.version is empty or undefined.
Run an invidividual conversion.
Recurse through archive files and convert files.
Use a list of files, and find a common base directory for them.
Recurse through archive file / directories and return files to be converted.
Recurse through directories and convert files.
Shows that we are progressing...
Parses the command line options and runs the conversion.
sets the usage string - if usage not given, uses getusagestring for each option
Allows setting options that will always be passed to openarchive.
Sets the errorlevel options.
Sets the format options using the given format dictionary.
Parameters: | formats (Dictionary) – The dictionary keys should be:
The dictionary values should be tuples of outputformat (string) and processor method. |
---|
creates a manpage option that allows the optionparser to generate a manpage
Sets the -P/--pot option depending on input/output formats etc.
Sets the progress options.
Sets -S/--timestamp option.
Splits pathname into name and ext, and removes the extsep.
Parameters: | pathname (string) – A file path |
---|---|
Returns: | root, ext |
Return type: | tuple |
Splits an inputpath into name and extension.
Splits a templatepath into name and extension.
Returns whether the given template exists...
Verifies that the options are valid (required options are present, etc).
Print a warning message incorporating ‘msg’ to stderr and exit.
A specialized Option Parser for convertor tools...
Adds an option to say what to do with duplicate strings.
Adds an option to include / exclude fuzzy translations.
Adds an option to say how to split the po/pot files.
add_option(opt_str, ..., kwarg=val, ...)
Adds an option to output only stores where translation percentage exceeds the threshold.
-> (values : Values, args : [string])
Check that the supplied option values and leftover arguments are valid. Returns the option values and leftover arguments (possibly adjusted, possibly completely new – whatever you like). Default implementation just returns the passed-in values; subclasses may override as desired.
Checks to see if subdir under options.output needs to be created, creates if neccessary.
Defines the given option, replacing an existing one of the same short name if neccessary...
Declare that you are done with this OptionParser. This cleans up reference cycles so the OptionParser (and all objects referenced by it) can be garbage-collected promptly. After calling destroy(), the OptionParser is unusable.
Set parsing to stop on the first non-option. Use this if you have a command processor which runs another command that has options of its own and you want to make sure these options don’t get confused.
Set parsing to not stop on the first non-option, allowing interspersing switches with command arguments. This is the default behavior. See also disable_interspersed_args() and the class documentation description of the attribute allow_interspersed_args.
Print a usage message incorporating ‘msg’ to stderr and exit. If you override this in a subclass, it should not return – it should either exit or raise an exception.
Filters input formats, processing relevant switches in options.
Filters output options, processing relevant switches in options.
Write the temp outputfile to its final destination.
returns a formatted manpage
Make a nice help string for describing formats...
Gets the absolute path to an input file.
Gets the absolute path to an output file.
Gets the absolute path to a template file.
Gets an output filename based on the input filename.
Works out which output format and processor method to use...
Get the options required to pass to the filtermethod...
Gets an output filename based on the input filename.
returns the usage string for the given option
returns the usage string for the given option
Sets up a progress bar appropriate to the options and files.
Checks if this path has been excluded.
Checks if fileoption is a recursive file.
Checks if this is a valid input filename.
Makes a subdirectory (recursively if neccessary).
Opens the input file.
Opens the output file.
Opens the template file (if required).
Opens a temporary output file.
Parses the command line options, handling implicit input/output args.
Converts a .po to a .pot where required.
Print an extended help message, listing all options and any help text provided with them, to ‘file’ (default stdout).
outputs a manpage for the program using the help information
Print the usage message for the current program (self.usage) to ‘file’ (default stdout). Any occurrence of the string “%prog” in self.usage is replaced with the name of the current program (basename of sys.argv[0]). Does nothing if self.usage is empty or not defined.
Print the version message for this program (self.version) to ‘file’ (default stdout). As with print_usage(), any occurrence of “%prog” in self.version is replaced by the current program’s name. Does nothing if self.version is empty or undefined.
Use a list of files, and find a common base directory for them.
Recurse through directories and return files to be processed.
Recurse through directories and process files.
Shows that we are progressing...
Parses the command line options and runs the conversion.
sets the usage string - if usage not given, uses getusagestring for each option
Sets the errorlevel options.
Sets the format options using the given format dictionary.
Parameters: | formats (Dictionary) – The dictionary keys should be:
The dictionary values should be tuples of outputformat (string) and processor method. |
---|
creates a manpage option that allows the optionparser to generate a manpage
Sets the -P/--pot option depending on input/output formats etc.
Sets the progress options.
Sets -S/--timestamp option.
Splits pathname into name and ext, and removes the extsep.
Parameters: | pathname (string) – A file path |
---|---|
Returns: | root, ext |
Return type: | tuple |
Splits an inputpath into name and extension.
Splits a templatepath into name and extension.
Returns whether the given template exists...
Verifies that the options are valid (required options are present, etc).
Print a warning message incorporating ‘msg’ to stderr and exit.
An object that knows how to replace strings in files.
actually replace the text
copies the input file to the output file, searching and replacing
Copies the template file to the output file, searching and replacing.
Copies the input file to the output file.
Copies the template file to the output file.
Check if the percent of translated source words more than or equal to the given threshold.
Convert Comma-Separated Value (.csv) files to Gettext PO localization files.
See: http://docs.translatehouse.org/projects/translate-toolkit/en/latest/commands/csv2po.html for examples and usage instructions.
reads in inputfile using csvl10n, converts using csv2po, writes to outputfile
a class that takes translations from a .csv file and puts them in a .po file
converts a csvfile to a pofile, and returns it. uses templatepo if given at construction
converts csv unit to po unit
handles reintegrating a csv unit into the .po file
makes indexes required for searching...
Use pairs of (original, replacement) to replace text found in source.
Parameters: |
|
---|---|
Returns: | String with *pairs of strings replaced |
Convert Comma-Separated Value (.csv) files to a TermBase eXchange (.tbx) glossary file
See: http://docs.translatehouse.org/projects/translate-toolkit/en/latest/commands/csv2tbx.html for examples and usage instructions
reads in inputfile using csvl10n, converts using csv2tbx, writes to outputfile
Convert a Mozilla .dtd UTF-8 localization format to a Gettext PO localization file.
Uses the po and dtd modules, and the dtd2po convertor class which is in this module You can convert back to .dtd using po2dtd.py.
reads in inputfile and templatefile using dtd, converts using dtd2po, writes to outputfile
Says if the given entity is likely to contain CSS that should not be translated.
Factory methods to convert supported input files to supported translatable files.
Convert HTML files to Gettext PO localization files.
See: http://docs.translatehouse.org/projects/translate-toolkit/en/latest/commands/html2po.html for examples and usage instructions.
reads in stdin using fromfileclass, converts using convertorclass, writes to stdout
Convert iCal files to Gettext PO localization files.
See: http://docs.translatehouse.org/projects/translate-toolkit/en/latest/commands/ical2po.html for examples and usage instructions.
Reads in input_file using iCal, converts using ical2po, writes to output_file.
convert a iCal file to a .po file for handling the translation...
converts a iCal file to a .po file...
Converts a .ini unit to a .po unit. Returns None if empty or not for translation.
converts two iCal files to a .po file...
Convert .ini files to Gettext PO localization files.
See: http://docs.translatehouse.org/projects/translate-toolkit/en/latest/commands/ini2po.html for examples and usage instructions.
Read in input_file using ini, converts using ini2po, writes to output_file.
Convert a .ini file to a .po file for handling the translation...
Convert a .ini file to a .po file...
Convert a .ini unit to a .po unit. Returns None if empty or not for translation.
Convert two .ini files to a .po file...
Convert JSON files to Gettext PO localization files.
See: http://docs.translatehouse.org/projects/translate-toolkit/en/latest/commands/json2po.html for examples and usage instructions.
Reads in input_file using jsonl10n, converts using json2po, writes to output_file.
Convert a JSON file to a PO file
Converts a JSON file to a PO file
Converts a JSON unit to a PO unit
Returns: | None if empty or not for translation |
---|
Converts two JSON files to a PO file
Convert Mozilla .dtd and .properties files to Gettext PO localization files.
See: http://docs.translatehouse.org/projects/translate-toolkit/en/latest/commands/moz2po.html for examples and usage instructions.
Converts additional Mozilla files to properties files.
wraps prop2po but converts input/template files to properties first
convert a .inc file with #defines in it to a properties file
wraps prop2po but converts input/template files to properties first
convert a pseudo-properties .it file to a conventional properties file
Convert Mozilla .lang files to Gettext PO localization files.
reads in stdin using fromfileclass, converts using convertorclass, writes to stdout
Convert OpenDocument (ODF) files to XLIFF localization files.
See: http://docs.translatehouse.org/projects/translate-toolkit/en/latest/commands/odf2xliff.html for examples and usage instructions.
reads in stdin using fromfileclass, converts using convertorclass, writes to stdout
Convert an OpenOffice.org (SDF) localization file to Gettext PO localization files.
See: http://docs.translatehouse.org/projects/translate-toolkit/en/latest/commands/oo2po.html for examples and usage instructions.
reads in stdin using inputstore class, converts using convertorclass, writes to stdout
verifies the commandline options
Convert an OpenOffice.org (SDF) localization file to XLIFF localization files.
See: http://docs.translatehouse.org/projects/translate-toolkit/en/latest/commands/oo2po.html for examples and usage instructions.
reads in stdin using inputstore class, converts using convertorclass, writes to stdout
verifies the commandline options
Convert PHP localization files to Gettext PO localization files.
See: http://docs.translatehouse.org/projects/translate-toolkit/en/latest/commands/php2po.html for examples and usage instructions.
Read inputfile using php, convert using php2po, write to outputfile.
Convert a .php file to a .po file for handling the translation.
Convert a .php file to a .po file.
Convert a .php unit to a .po unit.
Convert two .php files to a .po file.
Convert Gettext PO localization files to Comma-Separated Value (.csv) files.
See: http://docs.translatehouse.org/projects/translate-toolkit/en/latest/commands/csv2po.html for examples and usage instructions.
reads in inputfile using po, converts using po2csv, writes to outputfile
Converts a Gettext PO file to a UTF-8 encoded Mozilla .dtd file.
applies the translation for entity in the po unit to the dtd unit
this is a convertor class that creates a new dtd file based on a po file without a template
this is a convertor class that creates a new dtd based on a template using translations in a po
Convert Gettext PO localization files to HTML files.
See: http://docs.translatehouse.org/projects/translate-toolkit/en/latest/commands/html2po.html for examples and usage instructions.
reads in stdin using fromfileclass, converts using convertorclass, writes to stdout
Convert Gettext PO localization files to iCal files.
See: http://docs.translatehouse.org/projects/translate-toolkit/en/latest/commands/ical2po.html for examples and usage instructions.
Convert Gettext PO localization files to .ini files.
See: http://docs.translatehouse.org/projects/translate-toolkit/en/latest/commands/ini2po.html for examples and usage instructions.
Convert Gettext PO localization files to JSON files.
See: http://docs.translatehouse.org/projects/translate-toolkit/en/latest/commands/json2po.html for examples and usage instructions.
Convert Gettext PO localization files to Mozilla .lang files.
reads in stdin using fromfileclass, converts using convertorclass, writes to stdout
Convert Gettext PO localization files to Mozilla .dtd and .properties files.
See: http://docs.translatehouse.org/projects/translate-toolkit/en/latest/commands/moz2po.html for examples and usage instructions.
Convert Gettext PO localization files to an OpenOffice.org (SDF) localization file.
See: http://docs.translatehouse.org/projects/translate-toolkit/en/latest/commands/oo2po.html for examples and usage instructions.
Convert Gettext PO localization files to PHP localization files.
See: http://docs.translatehouse.org/projects/translate-toolkit/en/latest/commands/php2po.html for examples and usage instructions.
Convert Gettext PO localization files to Java/Mozilla .properties files.
See: http://docs.translatehouse.org/projects/translate-toolkit/en/latest/commands/prop2po.html for examples and usage instructions.
applies the translation for key in the po unit to the prop unit
Mozilla specific convertor function
.strings specific convertor function
Convert Gettext PO localization files back to Windows Resource (.rc) files.
See: http://docs.translatehouse.org/projects/translate-toolkit/en/latest/commands/rc2po.html for examples and usage instructions.
Convert Gettext PO localization files to subtitle files.
See: http://docs.translatehouse.org/projects/translate-toolkit/en/latest/commands/sub2po.html for examples and usage instructions.
Convert Gettext PO localization files to Symbian translation files.
See: http://docs.translatehouse.org/projects/translate-toolkit/en/latest/commands/symb2po.html for examples and usage instructions.
Convert Gettext PO files to TikiWiki’s language.php files.
See: http://docs.translatehouse.org/projects/translate-toolkit/en/latest/commands/tiki2po.html for examples and usage instructions.
Converts from po file format to tiki.
Parameters: |
|
---|
Will convert from .po to tiki style .php
Convert Gettext PO localization files to a TMX (Translation Memory eXchange) file.
See: http://docs.translatehouse.org/projects/translate-toolkit/en/latest/commands/po2tmx.html for examples and usage instructions.
reads in stdin using fromfileclass, converts using convertorclass, writes to stdout
Convert Gettext PO localization files to Qt Linguist (.ts) files.
See: http://docs.translatehouse.org/projects/translate-toolkit/en/latest/commands/ts2po.html for examples and usage instructions.
reads in stdin using fromfileclass, converts using convertorclass, writes to stdout
Convert Gettext PO localization files to plain text (.txt) files.
See: http://docs.translatehouse.org/projects/translate-toolkit/en/latest/commands/txt2po.html for examples and usage instructions.
reads in stdin using fromfileclass, converts using convertorclass, writes to stdout
po2txt can take a po file and generate txt. best to give it a template file otherwise will just concat msgstrs
converts a file to txt format
converts a file to txt format
rewraps text as required
Convert GNU/gettext PO files to web2py translation dictionaries (.py).
See: http://docs.translatehouse.org/projects/translate-toolkit/en/latest/commands/web2py2po.html for examples and usage instructions.
Convert Gettext PO localization files to a Wordfast translation memory file.
See: http://docs.translatehouse.org/projects/translate-toolkit/en/latest/commands/po2wordfast.html for examples and usage instructions.
reads in stdin using fromfileclass, converts using convertorclass, writes to stdout
Convert Gettext PO localization files to XLIFF localization files.
See: http://docs.translatehouse.org/projects/translate-toolkit/en/latest/commands/xliff2po.html for examples and usage instructions.
reads in stdin using fromfileclass, converts using convertorclass, writes to stdout
Simple script to do replacements on translated strings inside po files.
Convert template files (like .pot or template .xlf files) to translation files, preserving existing translations.
See: http://docs.translatehouse.org/projects/translate-toolkit/en/latest/commands/pot2po.html for examples and usage instructions.
Actual conversion function, works on stores not files, returns a properly initialized pretranslated output store, with structure based on input_store, metadata based on template_store, migrates old translations from template_store and pretranslating from TM.
Main conversion function.
Converts properties files to additional Mozilla format files.
wraps po2prop but converts outputfile to properties first
wraps po2prop but converts outputfile to properties first using UTF-8 encoding
wraps po2prop but converts outputfile to properties first
convert a properties file back to a .inc file with #defines in it
convert a properties file back to a pseudo-properties .it file
Convert Java/Mozilla .properties files to Gettext PO localization files.
See: http://docs.translatehouse.org/projects/translate-toolkit/en/latest/commands/prop2po.html for examples and usage instructions.
Mozilla specific convertor function
reads in inputfile using properties, converts using prop2po, writes to outputfile
.strings specific convertor function
convert a .properties file to a .po file for handling the translation.
Converts a unit from store to a po unit, keeping track of mixed names along the way.
mixbucket can be specified to indicate if the given unit is part of the template or the translated file.
converts a .properties file to a .po file...
Converts a .properties unit to a .po unit. Returns None if empty or not for translation.
Fold the multiple plural units of a gaia file into a gettext plural.
converts two .properties files to a .po file...
Convert Windows RC files to Gettext PO localization files.
See: http://docs.translatehouse.org/projects/translate-toolkit/en/latest/commands/rc2po.html for examples and usage instructions.
reads in input_file using rc, converts using rc2po, writes to output_file
Convert a .rc file to a .po file for handling the translation.
converts a .rc file to a .po file...
Converts a .rc unit to a .po unit. Returns None if empty or not for translation.
converts two .rc files to a .po file...
Convert subtitle files to Gettext PO localization files.
See: http://docs.translatehouse.org/projects/translate-toolkit/en/latest/commands/sub2po.html for examples and usage instructions.
converts a subtitle file to a .po file...
Converts a subtitle unit to a .po unit. Returns None if empty or not for translation.
Reads in input_file using translate.subtitles, converts using sub2po, writes to output_file.
converts two subtitle files to a .po file...
Convert Symbian localisation files to Gettext PO localization files.
See: http://docs.translatehouse.org/projects/translate-toolkit/en/latest/commands/symb2po.html for examples and usage instructions.
Convert TikiWiki’s language.php files to GetText PO files.
See: http://docs.translatehouse.org/projects/translate-toolkit/en/latest/commands/tiki2po.html for examples and usage instructions.
Converts from tiki file format to po.
Parameters: |
|
---|
Converts tiki .php files to .po.
Convert Qt Linguist (.ts) files to Gettext PO localization files.
See: http://docs.translatehouse.org/projects/translate-toolkit/en/latest/commands/ts2po.html for examples and usage instructions.
reads in stdin using fromfileclass, converts using convertorclass, writes to stdout
Convert plain text (.txt) files to Gettext PO localization files.
See: http://docs.translatehouse.org/projects/translate-toolkit/en/latest/commands/txt2po.html for examples and usage instructions.
reads in stdin using fromfileclass, converts using convertorclass, writes to stdout
Convert web2py translation dictionaries (.py) to GNU/gettext PO files.
See: http://docs.translatehouse.org/projects/translate-toolkit/en/latest/commands/web2py2po.html for examples and usage instructions.
Convert XLIFF translation files to OpenDocument (ODF) files.
See: http://docs.translatehouse.org/projects/translate-toolkit/en/latest/commands/odf2xliff.html for examples and usage instructions.
reads in stdin using fromfileclass, converts using convertorclass, writes to stdout
Convert XLIFF localization files to an OpenOffice.org (SDF) localization file.
See: http://docs.translatehouse.org/projects/translate-toolkit/en/latest/commands/oo2po.html for examples and usage instructions.
Convert XLIFF localization files to Gettext PO localization files.
See: http://docs.translatehouse.org/projects/translate-toolkit/en/latest/commands/xliff2po.html for examples and usage instructions.
reads in stdin using fromfileclass, converts using convertorclass, writes to stdout