# convert

Code to convert between different storage formats for localizations.

## acesskey

functions used to manipulate access keys in strings

class `translate.convert.accesskey.``UnitMixer`(labelsuffixes, accesskeysuffixes)

  Helper to mix separately defined labels and accesskeys into one unit.

  `match_entities`(index)

    Populates mixedentities from the index.

  `mix_units`(label_unit, accesskey_unit, target_unit)

    Mix the given units into the given target_unit if possible.

    Might return None if no match is possible.

`translate.convert.accesskey.``combine`(label, accesskey, accesskey_marker=u'&')

  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:

  - label (unicode) – a label
  - accesskey (unicode char) – The accesskey

  Return type: | unicode or None
  Returns: | label+accesskey string or None if uncombineable

`translate.convert.accesskey.``extract`(string, accesskey_marker=u'&')

  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:

  - string (Unicode) – A string that might contain a label with accesskey marker
  - accesskey_marker (Char) – The character that is used to prefix an access key

## convert

Handles converting of files between formats (used by `translate.convert` tools).

class `translate.convert.convert.``ArchiveConvertOptionParser`(formats, usetemplates=False, usepots=False, description=None, archiveformats=None)

  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)`.

  `add_duplicates_option`(default='msgctxt')

    Adds an option to say what to do with duplicate strings.

  `add_fuzzy_option`(default=False)

    Adds an option to include / exclude fuzzy translations.

  `add_multifile_option`(default='single')

    Adds an option to say how to split the po/pot files.

  `add_option`(Option)

    add_option(opt_str, ..., kwarg=val, ...)

  `add_threshold_option`(default=None)

    Adds an option to output only stores where translation percentage exceeds the threshold.

  `check_values`(values : Values, args : [string])

    -> (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.

  `checkoutputsubdir`(options, subdir)

    Checks to see if subdir under `options.output` needs to be created, creates if neccessary.

  `define_option`(option)

    Defines the given option, replacing an existing one of the same short name if neccessary...

  `destroy`()

    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.

  `disable_interspersed_args`()

    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.

  `enable_interspersed_args`()

    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.

  `error`(msg : string)

    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.

  `filterinputformats`(options)

    Filters input formats, processing relevant switches in options.

  `filteroutputoptions`(options)

    Filters output options, processing relevant switches in options.

  `finalizetempoutputfile`(options, outputfile, fulloutputpath)

    Write the temp outputfile to its final destination.

  `format_manpage`()

    returns a formatted manpage

  `getarchiveclass`(fileext, filepurpose, isdir=False)

    Returns the archiveclass for the given fileext and filepurpose

  `getformathelp`(formats)

    Make a nice help string for describing formats...

  `getfullinputpath`(options, inputpath)

    Gets the absolute path to an input file.

  `getfulloutputpath`(options, outputpath)

    Gets the absolute path to an output file.

  `getfulltemplatepath`(options, templatepath)

    Gets the absolute path to a template file.

  `getoutputname`(options, inputname, outputformat)

    Gets an output filename based on the input filename.

  `getoutputoptions`(options, inputpath, templatepath)

    Works out which output format and processor method to use...

  `getpassthroughoptions`(options)

    Get the options required to pass to the filtermethod...

  `gettemplatename`(options, inputname)

    Gets an output filename based on the input filename.

  `getusageman`(option)

    returns the usage string for the given option

  `getusagestring`(option)

    returns the usage string for the given option

  `initoutputarchive`(options)

    Creates an outputarchive if required.

  `initprogressbar`(allfiles, options)

    Sets up a progress bar appropriate to the options and files.

  `inittemplatearchive`(options)

    Opens the `templatearchive` if not already open.

  `isarchive`(fileoption, filepurpose='input')

    Returns whether the file option is an archive file.

  `isexcluded`(options, inputpath)

    Checks if this path has been excluded.

  `isrecursive`(fileoption, filepurpose='input')

    Checks if fileoption is a recursive file.

  `isvalidinputname`(options, inputname)

    Checks if this is a valid input filename.

  `mkdir`(parent, subdir)

    Makes a subdirectory (recursively if neccessary).

  `openarchive`(archivefilename, filepurpose, **kwargs)

    Creates an archive object for the given file.

  `openinputfile`(options, fullinputpath)

    Opens the input file.

  `openoutputfile`(options, fulloutputpath)

    Opens the output file.

  `opentemplatefile`(options, fulltemplatepath)

    Opens the template file (if required).

  `opentempoutputfile`(options, fulloutputpath)

    Opens a temporary output file.

  `parse_args`(args=None, values=None)

    Parses the command line options, handling implicit input/output args.

  `potifyformat`(fileformat)

    Converts a .po to a .pot where required.

  `print_help`(file : file = stdout)

    Print an extended help message, listing all options and any help text provided with them, to ‘file’ (default stdout).

  `print_manpage`(file=None)

    outputs a manpage for the program using the help information

  `print_usage`(file : file = stdout)

    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_version`(file : file = stdout)

    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.

  `processfile`(fileprocessor, options, fullinputpath, fulloutputpath, fulltemplatepath)

    Run an invidividual conversion.

  `recursearchivefiles`(options)

    Recurse through archive files and convert files.

  `recurseinputfilelist`(options)

    Use a list of files, and find a common base directory for them.

  `recurseinputfiles`(options)

    Recurse through archive file / directories and return files to be converted.

  `recursiveprocess`(options)

    Recurse through directories and convert files.

  `reportprogress`(filename, success)

    Shows that we are progressing...

  `run`(argv=None)

    Parses the command line options and runs the conversion.

  `set_usage`(usage=None)

    sets the usage string - if usage not given, uses getusagestring for each option

  `setarchiveoptions`(**kwargs)

    Allows setting options that will always be passed to openarchive.

  `seterrorleveloptions`()

    Sets the errorlevel options.

  `setformats`(formats, usetemplates)

    Sets the format options using the given format dictionary.

    Parameters:

    formats (Dictionary) –

    The dictionary keys should be:
    - Single strings (or 1-tuples) containing an input format (if not usetemplates)
    - Tuples containing an input format and template format (if usetemplates)
    - Formats can be None to indicate what to do with standard input

    The dictionary values should be tuples of outputformat (string) and processor method.

  `setmanpageoption`()

    creates a manpage option that allows the optionparser to generate a manpage

  `setpotoption`()

    Sets the `-P`/`--pot` option depending on input/output formats etc.

  `setprogressoptions`()

    Sets the progress options.

  `settimestampoption`()

    Sets `-S`/`--timestamp` option.

  `splitext`(pathname)

    Splits pathname into name and ext, and removes the extsep.

    Parameters: | pathname (string) – A file path
    Returns: | root, ext
    Return type: | tuple

  `splitinputext`(inputpath)

    Splits an inputpath into name and extension.

  `splittemplateext`(templatepath)

    Splits a templatepath into name and extension.

  `templateexists`(options, templatepath)

    Returns whether the given template exists...

  `verifyoptions`(options)

    Verifies that the options are valid (required options are present, etc).

  `warning`(msg, options=None, exc_info=None)

    Print a warning message incorporating ‘msg’ to stderr and exit.

class `translate.convert.convert.``ConvertOptionParser`(formats, usetemplates=False, usepots=False, allowmissingtemplate=False, description=None)

  A specialized Option Parser for convertor tools...

  `add_duplicates_option`(default='msgctxt')

    Adds an option to say what to do with duplicate strings.

  `add_fuzzy_option`(default=False)

    Adds an option to include / exclude fuzzy translations.

  `add_multifile_option`(default='single')

    Adds an option to say how to split the po/pot files.

  `add_option`(Option)

    add_option(opt_str, ..., kwarg=val, ...)

  `add_threshold_option`(default=None)

    Adds an option to output only stores where translation percentage exceeds the threshold.

  `check_values`(values : Values, args : [string])

    -> (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.

  `checkoutputsubdir`(options, subdir)

    Checks to see if subdir under options.output needs to be created, creates if neccessary.

  `define_option`(option)

    Defines the given option, replacing an existing one of the same short name if neccessary...

  `destroy`()

    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.

  `disable_interspersed_args`()

    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.

  `enable_interspersed_args`()

    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.

  `error`(msg : string)

    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.

  `filterinputformats`(options)

    Filters input formats, processing relevant switches in options.

  `filteroutputoptions`(options)

    Filters output options, processing relevant switches in options.

  `finalizetempoutputfile`(options, outputfile, fulloutputpath)

    Write the temp outputfile to its final destination.

  `format_manpage`()

    returns a formatted manpage

  `getformathelp`(formats)

    Make a nice help string for describing formats...

  `getfullinputpath`(options, inputpath)

    Gets the absolute path to an input file.

  `getfulloutputpath`(options, outputpath)

    Gets the absolute path to an output file.

  `getfulltemplatepath`(options, templatepath)

    Gets the absolute path to a template file.

  `getoutputname`(options, inputname, outputformat)

    Gets an output filename based on the input filename.

  `getoutputoptions`(options, inputpath, templatepath)

    Works out which output format and processor method to use...

  `getpassthroughoptions`(options)

    Get the options required to pass to the filtermethod...

  `gettemplatename`(options, inputname)

    Gets an output filename based on the input filename.

  `getusageman`(option)

    returns the usage string for the given option

  `getusagestring`(option)

    returns the usage string for the given option

  `initprogressbar`(allfiles, options)

    Sets up a progress bar appropriate to the options and files.

  `isexcluded`(options, inputpath)

    Checks if this path has been excluded.

  `isrecursive`(fileoption, filepurpose='input')

    Checks if fileoption is a recursive file.

  `isvalidinputname`(options, inputname)

    Checks if this is a valid input filename.

  `mkdir`(parent, subdir)

    Makes a subdirectory (recursively if neccessary).

  `openinputfile`(options, fullinputpath)

    Opens the input file.

  `openoutputfile`(options, fulloutputpath)

    Opens the output file.

  `opentemplatefile`(options, fulltemplatepath)

    Opens the template file (if required).

  `opentempoutputfile`(options, fulloutputpath)

    Opens a temporary output file.

  `parse_args`(args=None, values=None)

    Parses the command line options, handling implicit input/output args.

  `potifyformat`(fileformat)

    Converts a .po to a .pot where required.

  `print_help`(file : file = stdout)

    Print an extended help message, listing all options and any help text provided with them, to ‘file’ (default stdout).

  `print_manpage`(file=None)

    outputs a manpage for the program using the help information

  `print_usage`(file : file = stdout)

    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_version`(file : file = stdout)

    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.

  `recurseinputfilelist`(options)

    Use a list of files, and find a common base directory for them.

  `recurseinputfiles`(options)

    Recurse through directories and return files to be processed.

  `recursiveprocess`(options)

    Recurse through directories and process files.

  `reportprogress`(filename, success)

    Shows that we are progressing...

  `run`(argv=None)

    Parses the command line options and runs the conversion.

  `set_usage`(usage=None)

    sets the usage string - if usage not given, uses getusagestring for each option

  `seterrorleveloptions`()

    Sets the errorlevel options.

  `setformats`(formats, usetemplates)

    Sets the format options using the given format dictionary.

    Parameters:

    formats (Dictionary) –

    The dictionary keys should be:
    - Single strings (or 1-tuples) containing an input format (if not usetemplates)
    - Tuples containing an input format and template format (if usetemplates)
    - Formats can be None to indicate what to do with standard input

    The dictionary values should be tuples of outputformat (string) and processor method.

  `setmanpageoption`()

    creates a manpage option that allows the optionparser to generate a manpage

  `setpotoption`()

    Sets the `-P`/`--pot` option depending on input/output formats etc.

  `setprogressoptions`()

    Sets the progress options.

  `settimestampoption`()

    Sets `-S`/`--timestamp` option.

  `splitext`(pathname)

    Splits pathname into name and ext, and removes the extsep.

    Parameters: | pathname (string) – A file path
    Returns: | root, ext
    Return type: | tuple

  `splitinputext`(inputpath)

    Splits an inputpath into name and extension.

  `splittemplateext`(templatepath)

    Splits a templatepath into name and extension.

  `templateexists`(options, templatepath)

    Returns whether the given template exists...

  `verifyoptions`(options)

    Verifies that the options are valid (required options are present, etc).

  `warning`(msg, options=None, exc_info=None)

    Print a warning message incorporating ‘msg’ to stderr and exit.

class `translate.convert.convert.``Replacer`(searchstring, replacestring)

  An object that knows how to replace strings in files.

  `doreplace`(text)

    actually replace the text

  `searchreplaceinput`(inputfile, outputfile, templatefile, **kwargs)

    copies the input file to the output file, searching and replacing

  `searchreplacetemplate`(inputfile, outputfile, templatefile, **kwargs)

    Copies the template file to the output file, searching and replacing.

`translate.convert.convert.``copyinput`(inputfile, outputfile, templatefile, **kwargs)

  Copies the input file to the output file.

`translate.convert.convert.``copytemplate`(inputfile, outputfile, templatefile, **kwargs)

  Copies the template file to the output file.

`translate.convert.convert.``should_output_store`(store, threshold)

  Check if the percent of translated source words more than or equal to the given threshold.

## csv2po

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.

`translate.convert.csv2po.``convertcsv`(inputfile, outputfile, templatefile, charset=None, columnorder=None, duplicatestyle='msgctxt')

  reads in inputfile using csvl10n, converts using csv2po, writes to outputfile

class `translate.convert.csv2po.``csv2po`(templatepo=None, charset=None, duplicatestyle='keep')

  a class that takes translations from a .csv file and puts them in a .po file

  `convertstore`(thecsvfile)

    converts a csvfile to a pofile, and returns it. uses templatepo if given at construction

  `convertunit`(csvunit)

    converts csv unit to po unit

  `handlecsvunit`(csvunit)

    handles reintegrating a csv unit into the .po file

  `makeindex`()

    makes indexes required for searching...

`translate.convert.csv2po.``replacestrings`(source, *pairs)

  Use `pairs` of `(original, replacement)` to replace text found in `source`.

  Parameters:

  - source (String) – String to on which `pairs` of strings are to be replaced
  - *pairs (One or more tuples of (original, replacement)) – Strings to be matched and replaced

  Returns: | String with `*pairs` of strings replaced

## csv2tbx

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

`translate.convert.csv2tbx.``convertcsv`(inputfile, outputfile, templatefile, charset=None, columnorder=None)

  reads in inputfile using csvl10n, converts using csv2tbx, writes to outputfile

class `translate.convert.csv2tbx.``csv2tbx`(charset=None)

  a class that takes translations from a .csv file and puts them in a .tbx file

  `convertfile`(csvfile)

    converts a csvfile to a tbxfile, and returns it. uses templatepo if given at construction

## dtd2po

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.

`translate.convert.dtd2po.``convertdtd`(inputfile, outputfile, templatefile, pot=False, duplicatestyle='msgctxt')

  reads in inputfile and templatefile using dtd, converts using dtd2po, writes to outputfile

`translate.convert.dtd2po.``is_css_entity`(entity)

  Says if the given entity is likely to contain CSS that should not be translated.

## factory

Factory methods to convert supported input files to supported translatable files.

## html2po

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.

`translate.convert.html2po.``converthtml`(inputfile, outputfile, templates, includeuntagged=False, pot=False, duplicatestyle='msgctxt', keepcomments=False)

  reads in stdin using fromfileclass, converts using convertorclass, writes to stdout

## ical2po

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.

`translate.convert.ical2po.``convertical`(input_file, output_file, template_file, pot=False, duplicatestyle='msgctxt')

  Reads in input_file using iCal, converts using `ical2po`, writes to output_file.

class `translate.convert.ical2po.``ical2po`

  convert a iCal file to a .po file for handling the translation...

  `convert_store`(input_store, duplicatestyle='msgctxt')

    converts a iCal file to a .po file...

  `convert_unit`(input_unit, commenttype)

    Converts a .ini unit to a .po unit. Returns None if empty or not for translation.

  `merge_store`(template_store, input_store, blankmsgstr=False, duplicatestyle='msgctxt')

    converts two iCal files to a .po file...

## ini2po

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.

`translate.convert.ini2po.``convertini`(input_file, output_file, template_file, pot=False, duplicatestyle='msgctxt', dialect='default')

  Read in input_file using ini, converts using `ini2po`, writes to output_file.

class `translate.convert.ini2po.``ini2po`

  Convert a .ini file to a .po file for handling the translation...

  `convert_store`(input_store, duplicatestyle='msgctxt')

    Convert a .ini file to a .po file...

  `convert_unit`(input_unit, commenttype)

    Convert a .ini unit to a .po unit. Returns None if empty or not for translation.

  `merge_store`(template_store, input_store, blankmsgstr=False, duplicatestyle='msgctxt')

    Convert two .ini files to a .po file...

## json2po

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.

`translate.convert.json2po.``convertjson`(input_file, output_file, template_file, pot=False, duplicatestyle='msgctxt', dialect='default', filter=None)

  Reads in input_file using jsonl10n, converts using `json2po`, writes to output_file.

class `translate.convert.json2po.``json2po`

  Convert a JSON file to a PO file

  `convert_store`(input_store, duplicatestyle='msgctxt')

    Converts a JSON file to a PO file

  `convert_unit`(input_unit, commenttype)

    Converts a JSON unit to a PO unit

    Returns: | None if empty or not for translation

  `merge_store`(template_store, input_store, blankmsgstr=False, duplicatestyle='msgctxt')

    Converts two JSON files to a PO file

## moz2po

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.

## mozfunny2prop

Converts additional Mozilla files to properties files.

`translate.convert.mozfunny2prop.``inc2po`(inputfile, outputfile, templatefile, encoding=None, pot=False, duplicatestyle='msgctxt')

  wraps prop2po but converts input/template files to properties first

`translate.convert.mozfunny2prop.``inc2prop`(lines)

  convert a .inc file with #defines in it to a properties file

`translate.convert.mozfunny2prop.``it2po`(inputfile, outputfile, templatefile, encoding='cp1252', pot=False, duplicatestyle='msgctxt')

  wraps prop2po but converts input/template files to properties first

`translate.convert.mozfunny2prop.``it2prop`(lines, encoding='cp1252')

  convert a pseudo-properties .it file to a conventional properties file

## mozlang2po

Convert Mozilla .lang files to Gettext PO localization files.

`translate.convert.mozlang2po.``convertlang`(inputfile, outputfile, templates, pot=False, duplicatestyle='msgctxt', encoding='utf-8')

  reads in stdin using fromfileclass, converts using convertorclass, writes to stdout

## odf2xliff

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.

`translate.convert.odf2xliff.``convertodf`(inputfile, outputfile, templates, engine='toolkit')

  reads in stdin using fromfileclass, converts using convertorclass, writes to stdout

## oo2po

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.

`translate.convert.oo2po.``convertoo`(inputfile, outputfile, templates, pot=False, sourcelanguage=None, targetlanguage=None, duplicatestyle='msgid_comment', multifilestyle='single')

  reads in stdin using inputstore class, converts using convertorclass, writes to stdout

`translate.convert.oo2po.``verifyoptions`(options)

  verifies the commandline options

## oo2xliff

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.

`translate.convert.oo2xliff.``convertoo`(inputfile, outputfile, templates, pot=False, sourcelanguage=None, targetlanguage=None, duplicatestyle='msgctxt', multifilestyle='single')

  reads in stdin using inputstore class, converts using convertorclass, writes to stdout

`translate.convert.oo2xliff.``verifyoptions`(options)

  verifies the commandline options

## php2po

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.

`translate.convert.php2po.``convertphp`(inputfile, outputfile, templatefile, pot=False, duplicatestyle='msgctxt')

  Read inputfile using php, convert using php2po, write to outputfile.

class `translate.convert.php2po.``php2po`

  Convert a .php file to a .po file for handling the translation.

  `convertstore`(inputstore, duplicatestyle='msgctxt')

    Convert a .php file to a .po file.

  `convertunit`(inputunit, origin)

    Convert a .php unit to a .po unit.

  `mergestore`(templatestore, inputstore, blankmsgstr=False, duplicatestyle='msgctxt')

    Convert two .php files to a .po file.

## po2csv

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.

`translate.convert.po2csv.``convertcsv`(inputfile, outputfile, templatefile, columnorder=None)

  reads in inputfile using po, converts using po2csv, writes to outputfile

## po2dtd

Converts a Gettext PO file to a UTF-8 encoded Mozilla .dtd file.

`translate.convert.po2dtd.``applytranslation`(entity, dtdunit, inputunit, mixedentities)

  applies the translation for entity in the po unit to the dtd unit

class `translate.convert.po2dtd.``po2dtd`(android=False, remove_untranslated=False)

  this is a convertor class that creates a new dtd file based on a po file without a template

class `translate.convert.po2dtd.``redtd`(dtdfile, android=False, remove_untranslated=False)

  this is a convertor class that creates a new dtd based on a template using translations in a po

## po2html

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.

`translate.convert.po2html.``converthtml`(inputfile, outputfile, templatefile, includefuzzy=False, outputthreshold=None)

  reads in stdin using fromfileclass, converts using convertorclass, writes to stdout

class `translate.convert.po2html.``po2html`

  po2html can take a po file and generate html. best to give it a template file otherwise will just concat msgstrs

  `mergestore`(inputstore, templatetext, includefuzzy)

    converts a file to .po format

## po2ical

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.

## po2ini

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.

## po2json

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.

## po2mozlang

Convert Gettext PO localization files to Mozilla .lang files.

`translate.convert.po2mozlang.``convertlang`(inputfile, outputfile, templates, includefuzzy=False, mark_active=True, outputthreshold=None, remove_untranslated=None)

  reads in stdin using fromfileclass, converts using convertorclass, writes to stdout

## po2moz

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.

## po2oo

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.

## po2php

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.

## po2prop

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.

`translate.convert.po2prop.``applytranslation`(key, propunit, inunit, mixedkeys)

  applies the translation for key in the po unit to the prop unit

`translate.convert.po2prop.``convertmozillaprop`(inputfile, outputfile, templatefile, includefuzzy=False, remove_untranslated=False, outputthreshold=None)

  Mozilla specific convertor function

`translate.convert.po2prop.``convertstrings`(inputfile, outputfile, templatefile, personality='strings', includefuzzy=False, encoding=None, outputthreshold=None, remove_untranslated=False)

  .strings specific convertor function

## po2rc

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.

## po2sub

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.

## po2symb

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.

## po2tiki

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.

`translate.convert.po2tiki.``convertpo`(inputfile, outputfile, template=None)

  Converts from po file format to tiki.

  Parameters:

  - inputfile – file handle of the source
  - outputfile – file handle to write to
  - template – unused

`translate.convert.po2tiki.``main`(argv=None)

  Will convert from .po to tiki style .php

## po2tmx

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.

`translate.convert.po2tmx.``convertpo`(inputfile, outputfile, templatefile, sourcelanguage='en', targetlanguage=None, comment=None)

  reads in stdin using fromfileclass, converts using convertorclass, writes to stdout

## po2ts

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.

`translate.convert.po2ts.``convertpo`(inputfile, outputfile, templatefile, context)

  reads in stdin using fromfileclass, converts using convertorclass, writes to stdout

## po2txt

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.

`translate.convert.po2txt.``converttxt`(inputfile, outputfile, templatefile, wrap=None, includefuzzy=False, encoding='utf-8', outputthreshold=None)

  reads in stdin using fromfileclass, converts using convertorclass, writes to stdout

class `translate.convert.po2txt.``po2txt`(wrap=None)

  po2txt can take a po file and generate txt. best to give it a template file otherwise will just concat msgstrs

  `convertstore`(inputstore, includefuzzy)

    converts a file to txt format

  `mergestore`(inputstore, templatetext, includefuzzy)

    converts a file to txt format

  `wrapmessage`(message)

    rewraps text as required

## po2web2py

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.

## po2wordfast

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.

`translate.convert.po2wordfast.``convertpo`(inputfile, outputfile, templatefile, sourcelanguage='en', targetlanguage=None)

  reads in stdin using fromfileclass, converts using convertorclass, writes to stdout

## po2xliff

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.

`translate.convert.po2xliff.``convertpo`(inputfile, outputfile, templatefile)

  reads in stdin using fromfileclass, converts using convertorclass, writes to stdout

## poreplace

Simple script to do replacements on translated strings inside po files.

## pot2po

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.

`translate.convert.pot2po.``convert_stores`(input_store, template_store, temp_store=None, tm=None, min_similarity=75, fuzzymatching=True, **kwargs)

  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.

`translate.convert.pot2po.``convertpot`(input_file, output_file, template_file, tm=None, min_similarity=75, fuzzymatching=True, classes=None, classes_str={'lang': ('mozilla_lang', 'LangStore'), 'tbx': ('tbx', 'tbxfile'), 'qph': ('qph', 'QphFile'), 'xlf': ('xliff', 'xlifffile'), 'mo': ('mo', 'mofile'), '_trados_txt_tm': ('trados', 'TradosTxtTmFile'), 'tmx': ('tmx', 'tmxfile'), 'utf8': ('omegat', 'OmegaTFile'), 'pot': ('po', 'pofile'), 'ts': ('ts2', 'tsfile'), 'sdlxliff': ('xliff', 'xlifffile'), 'tab': ('omegat', 'OmegaTFileTab'), 'catkeys': ('catkeys', 'CatkeysFile'), 'xliff': ('xliff', 'xlifffile'), 'gmo': ('mo', 'mofile'), 'utx': ('utx', 'UtxFile'), 'csv': ('csvl10n', 'csvfile'), 'qm': ('qm', 'qmfile'), 'po': ('po', 'pofile'), '_wftm': ('wordfast', 'WordfastTMFile')}, **kwargs)

  Main conversion function.

## prop2mozfunny

Converts properties files to additional Mozilla format files.

`translate.convert.prop2mozfunny.``po2inc`(inputfile, outputfile, templatefile, encoding=None, includefuzzy=False, remove_untranslated=False, outputthreshold=None)

  wraps po2prop but converts outputfile to properties first

`translate.convert.prop2mozfunny.``po2ini`(inputfile, outputfile, templatefile, encoding='UTF-8', includefuzzy=False, remove_untranslated=False, outputthreshold=None)

  wraps po2prop but converts outputfile to properties first using UTF-8 encoding

`translate.convert.prop2mozfunny.``po2it`(inputfile, outputfile, templatefile, encoding='cp1252', includefuzzy=False, remove_untranslated=False, outputthreshold=None)

  wraps po2prop but converts outputfile to properties first

`translate.convert.prop2mozfunny.``prop2inc`(pf)

  convert a properties file back to a .inc file with #defines in it

`translate.convert.prop2mozfunny.``prop2it`(pf)

  convert a properties file back to a pseudo-properties .it file

## prop2po

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.

`translate.convert.prop2po.``convertmozillaprop`(inputfile, outputfile, templatefile, pot=False, duplicatestyle='msgctxt')

  Mozilla specific convertor function

`translate.convert.prop2po.``convertprop`(inputfile, outputfile, templatefile, personality='java', pot=False, duplicatestyle='msgctxt', encoding=None)

  reads in inputfile using properties, converts using prop2po, writes to outputfile

`translate.convert.prop2po.``convertstrings`(inputfile, outputfile, templatefile, personality='strings', pot=False, duplicatestyle='msgctxt', encoding=None)

  .strings specific convertor function

class `translate.convert.prop2po.``prop2po`(personality='java', blankmsgstr=False, duplicatestyle='msgctxt')

  convert a .properties file to a .po file for handling the translation.

  `convertpropunit`(store, unit, commenttype, mixbucket='dtd')

    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.

  `convertstore`(thepropfile)

    converts a .properties file to a .po file...

  `convertunit`(propunit, commenttype)

    Converts a .properties unit to a .po unit. Returns None if empty or not for translation.

  `fold_gaia_plurals`(postore)

    Fold the multiple plural units of a gaia file into a gettext plural.

  `mergestore`(origpropfile, translatedpropfile)

    converts two .properties files to a .po file...

## rc2po

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.

`translate.convert.rc2po.``convertrc`(input_file, output_file, template_file, pot=False, duplicatestyle='msgctxt', charset=None, lang=None, sublang=None)

  reads in input_file using rc, converts using rc2po, writes to output_file

class `translate.convert.rc2po.``rc2po`

  Convert a .rc file to a .po file for handling the translation.

  `convert_store`(input_store, duplicatestyle='msgctxt')

    converts a .rc file to a .po file...

  `convert_unit`(input_unit, commenttype)

    Converts a .rc unit to a .po unit. Returns None if empty or not for translation.

  `merge_store`(template_store, input_store, blankmsgstr=False, duplicatestyle='msgctxt')

    converts two .rc files to a .po file...

## sub2po

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.

`translate.convert.sub2po.``convert_store`(input_store, duplicatestyle='msgctxt')

  converts a subtitle file to a .po file...

`translate.convert.sub2po.``convert_unit`(input_unit, commenttype)

  Converts a subtitle unit to a .po unit. Returns None if empty or not for translation.

`translate.convert.sub2po.``convertsub`(input_file, output_file, template_file=None, pot=False, duplicatestyle='msgctxt')

  Reads in input_file using translate.subtitles, converts using `sub2po`, writes to output_file.

`translate.convert.sub2po.``merge_store`(template_store, input_store, blankmsgstr=False, duplicatestyle='msgctxt')

  converts two subtitle files to a .po file...

## symb2po

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.

## tiki2po

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.

`translate.convert.tiki2po.``converttiki`(inputfile, outputfile, template=None, includeunused=False)

  Converts from tiki file format to po.

  Parameters:

  - inputfile – file handle of the source
  - outputfile – file handle to write to
  - template – unused
  - includeunused – Include the “usused” section of the tiki file? Default: False

`translate.convert.tiki2po.``main`(argv=None)

  Converts tiki .php files to .po.

## ts2po

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.

`translate.convert.ts2po.``convertts`(inputfile, outputfile, templates, pot=False, duplicatestyle='msgctxt')

  reads in stdin using fromfileclass, converts using convertorclass, writes to stdout

## txt2po

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.

`translate.convert.txt2po.``converttxt`(inputfile, outputfile, templates, duplicatestyle='msgctxt', encoding='utf-8', flavour=None)

  reads in stdin using fromfileclass, converts using convertorclass, writes to stdout

## web2py2po

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.

## xliff2odf

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.

`translate.convert.xliff2odf.``convertxliff`(input_file, output_file, template)

  reads in stdin using fromfileclass, converts using convertorclass, writes to stdout

## xliff2oo

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.

## xliff2po

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.

`translate.convert.xliff2po.``convertxliff`(inputfile, outputfile, templates, duplicatestyle='msgctxt')

  reads in stdin using fromfileclass, converts using convertorclass, writes to stdout