ProjectFlask/Documentation/source/Plugin_Project_Flask.ProjectFlask.FlaskBabelExtension.PyBabelProjectExtension.html

Thu, 30 Dec 2021 12:11:32 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Thu, 30 Dec 2021 12:11:32 +0100
branch
eric7
changeset 67
ca1f40d179ce
parent 61
fe1e8783a95f
permissions
-rw-r--r--

Updated version info to indicate relation to eric7.

<!DOCTYPE html>
<html><head>
<title>Plugin_Project_Flask.ProjectFlask.FlaskBabelExtension.PyBabelProjectExtension</title>
<meta charset="UTF-8">
<link rel="stylesheet" href="styles.css">
</head>
<body>
<a NAME="top" ID="top"></a>
<h1>Plugin_Project_Flask.ProjectFlask.FlaskBabelExtension.PyBabelProjectExtension</h1>

<p>
Module implementing the project support for flask-babel.
</p>
<h3>Global Attributes</h3>

<table>
<tr><td>None</td></tr>
</table>
<h3>Classes</h3>

<table>

<tr>
<td><a href="#PyBabelProject">PyBabelProject</a></td>
<td>Class implementing the flask-babel project support.</td>
</tr>
</table>
<h3>Functions</h3>

<table>
<tr><td>None</td></tr>
</table>
<hr />
<hr />
<a NAME="PyBabelProject" ID="PyBabelProject"></a>
<h2>PyBabelProject</h2>

<p>
    Class implementing the flask-babel project support.
</p>
<h3>Derived from</h3>
QObject
<h3>Class Attributes</h3>

<table>
<tr><td>None</td></tr>
</table>
<h3>Class Methods</h3>

<table>
<tr><td>None</td></tr>
</table>
<h3>Methods</h3>

<table>

<tr>
<td><a href="#PyBabelProject.__init__">PyBabelProject</a></td>
<td>Constructor</td>
</tr>
<tr>
<td><a href="#PyBabelProject.__checkAvailability">__checkAvailability</a></td>
<td>Private slot to check the availability of the 'flask-babel' extension.</td>
</tr>
<tr>
<td><a href="#PyBabelProject.__configurePyBabel">__configurePyBabel</a></td>
<td>Private slot to show a dialog to edit the pybabel configuration.</td>
</tr>
<tr>
<td><a href="#PyBabelProject.__createBabelCfg">__createBabelCfg</a></td>
<td>Private method to create a template pybabel configuration file.</td>
</tr>
<tr>
<td><a href="#PyBabelProject.__ensurePybabelConfigured">__ensurePybabelConfigured</a></td>
<td>Private method to ensure, that PyBabel has been configured.</td>
</tr>
<tr>
<td><a href="#PyBabelProject.__flaskBabelAvailable">__flaskBabelAvailable</a></td>
<td>Private method to check, if the 'flask-babel' package is available.</td>
</tr>
<tr>
<td><a href="#PyBabelProject.__getLocale">__getLocale</a></td>
<td>Private method to extract the locale out of a file name.</td>
</tr>
<tr>
<td><a href="#PyBabelProject.__installFlaskBabel">__installFlaskBabel</a></td>
<td>Private slot to install the flask-babel extension into the configured environment.</td>
</tr>
<tr>
<td><a href="#PyBabelProject.__projectLanguageAdded">__projectLanguageAdded</a></td>
<td>Private slot handling the addition of a new language.</td>
</tr>
<tr>
<td><a href="#PyBabelProject.compileCatalogs">compileCatalogs</a></td>
<td>Public method to compile the message catalogs.</td>
</tr>
<tr>
<td><a href="#PyBabelProject.compileSelectedCatalogs">compileSelectedCatalogs</a></td>
<td>Public method to update the message catalogs.</td>
</tr>
<tr>
<td><a href="#PyBabelProject.determineCapability">determineCapability</a></td>
<td>Public method to determine the availability of flask-babel.</td>
</tr>
<tr>
<td><a href="#PyBabelProject.extractMessages">extractMessages</a></td>
<td>Public method to extract the messages catalog template file.</td>
</tr>
<tr>
<td><a href="#PyBabelProject.getBabelCommand">getBabelCommand</a></td>
<td>Public method to build the Babel command.</td>
</tr>
<tr>
<td><a href="#PyBabelProject.initActions">initActions</a></td>
<td>Public method to define the flask-babel actions.</td>
</tr>
<tr>
<td><a href="#PyBabelProject.initMenu">initMenu</a></td>
<td>Public method to initialize the flask-babel menu.</td>
</tr>
<tr>
<td><a href="#PyBabelProject.openPOEditor">openPOEditor</a></td>
<td>Public method to edit the given file in an external .po editor.</td>
</tr>
<tr>
<td><a href="#PyBabelProject.projectClosedHooks">projectClosedHooks</a></td>
<td>Public method to remove our hook methods.</td>
</tr>
<tr>
<td><a href="#PyBabelProject.projectOpenedHooks">projectOpenedHooks</a></td>
<td>Public method to add our hook methods.</td>
</tr>
<tr>
<td><a href="#PyBabelProject.registerOpenHook">registerOpenHook</a></td>
<td>Public method to register the open hook to open a translations file in a translations editor.</td>
</tr>
<tr>
<td><a href="#PyBabelProject.updateCatalogs">updateCatalogs</a></td>
<td>Public method to update the message catalogs.</td>
</tr>
<tr>
<td><a href="#PyBabelProject.updateCatalogsObsolete">updateCatalogsObsolete</a></td>
<td>Public method to update the message catalogs keeping obsolete translations.</td>
</tr>
<tr>
<td><a href="#PyBabelProject.updateSelectedCatalogs">updateSelectedCatalogs</a></td>
<td>Public method to update the selected message catalogs.</td>
</tr>
<tr>
<td><a href="#PyBabelProject.updateSelectedCatalogsObsolete">updateSelectedCatalogsObsolete</a></td>
<td>Public method to update the message catalogs keeping obsolete translations.</td>
</tr>
</table>
<h3>Static Methods</h3>

<table>
<tr><td>None</td></tr>
</table>

<a NAME="PyBabelProject.__init__" ID="PyBabelProject.__init__"></a>
<h4>PyBabelProject (Constructor)</h4>
<b>PyBabelProject</b>(<i>plugin, project, parent=None</i>)

<p>
        Constructor
</p>
<dl>

<dt><i>plugin</i> (ProjectFlaskPlugin)</dt>
<dd>
reference to the plugin object
</dd>
<dt><i>project</i> (Project)</dt>
<dd>
reference to the project object
</dd>
<dt><i>parent</i> (QObject)</dt>
<dd>
parent
</dd>
</dl>
<a NAME="PyBabelProject.__checkAvailability" ID="PyBabelProject.__checkAvailability"></a>
<h4>PyBabelProject.__checkAvailability</h4>
<b>__checkAvailability</b>(<i></i>)

<p>
        Private slot to check the availability of the 'flask-babel' extension.
</p>
<a NAME="PyBabelProject.__configurePyBabel" ID="PyBabelProject.__configurePyBabel"></a>
<h4>PyBabelProject.__configurePyBabel</h4>
<b>__configurePyBabel</b>(<i></i>)

<p>
        Private slot to show a dialog to edit the pybabel configuration.
</p>
<a NAME="PyBabelProject.__createBabelCfg" ID="PyBabelProject.__createBabelCfg"></a>
<h4>PyBabelProject.__createBabelCfg</h4>
<b>__createBabelCfg</b>(<i>configFile</i>)

<p>
        Private method to create a template pybabel configuration file.
</p>
<dl>

<dt><i>configFile</i> (str)</dt>
<dd>
name of the configuration file to be created
</dd>
</dl>
<dl>
<dt>Return:</dt>
<dd>
flag indicating successful configuration file creation
</dd>
</dl>
<dl>
<dt>Return Type:</dt>
<dd>
bool
</dd>
</dl>
<a NAME="PyBabelProject.__ensurePybabelConfigured" ID="PyBabelProject.__ensurePybabelConfigured"></a>
<h4>PyBabelProject.__ensurePybabelConfigured</h4>
<b>__ensurePybabelConfigured</b>(<i></i>)

<p>
        Private method to ensure, that PyBabel has been configured.
</p>
<dl>
<dt>Return:</dt>
<dd>
flag indicating successful configuration
</dd>
</dl>
<dl>
<dt>Return Type:</dt>
<dd>
bool
</dd>
</dl>
<a NAME="PyBabelProject.__flaskBabelAvailable" ID="PyBabelProject.__flaskBabelAvailable"></a>
<h4>PyBabelProject.__flaskBabelAvailable</h4>
<b>__flaskBabelAvailable</b>(<i></i>)

<p>
        Private method to check, if the 'flask-babel' package is available.
</p>
<dl>
<dt>Return:</dt>
<dd>
flag indicating the availability of 'flask-babel'
</dd>
</dl>
<dl>
<dt>Return Type:</dt>
<dd>
bool
</dd>
</dl>
<a NAME="PyBabelProject.__getLocale" ID="PyBabelProject.__getLocale"></a>
<h4>PyBabelProject.__getLocale</h4>
<b>__getLocale</b>(<i>filename</i>)

<p>
        Private method to extract the locale out of a file name.
</p>
<dl>

<dt><i>filename</i> (str)</dt>
<dd>
name of the file used for extraction
</dd>
</dl>
<dl>
<dt>Return:</dt>
<dd>
extracted locale
</dd>
</dl>
<dl>
<dt>Return Type:</dt>
<dd>
str or None
</dd>
</dl>
<a NAME="PyBabelProject.__installFlaskBabel" ID="PyBabelProject.__installFlaskBabel"></a>
<h4>PyBabelProject.__installFlaskBabel</h4>
<b>__installFlaskBabel</b>(<i></i>)

<p>
        Private slot to install the flask-babel extension into the configured
        environment.
</p>
<a NAME="PyBabelProject.__projectLanguageAdded" ID="PyBabelProject.__projectLanguageAdded"></a>
<h4>PyBabelProject.__projectLanguageAdded</h4>
<b>__projectLanguageAdded</b>(<i>code</i>)

<p>
        Private slot handling the addition of a new language.
</p>
<dl>

<dt><i>code</i> (str)</dt>
<dd>
language code of the new language
</dd>
</dl>
<a NAME="PyBabelProject.compileCatalogs" ID="PyBabelProject.compileCatalogs"></a>
<h4>PyBabelProject.compileCatalogs</h4>
<b>compileCatalogs</b>(<i>filenames</i>)

<p>
        Public method to compile the message catalogs.
</p>
<dl>

<dt><i>filenames</i> (list of str)</dt>
<dd>
list of filenames (not used)
</dd>
</dl>
<a NAME="PyBabelProject.compileSelectedCatalogs" ID="PyBabelProject.compileSelectedCatalogs"></a>
<h4>PyBabelProject.compileSelectedCatalogs</h4>
<b>compileSelectedCatalogs</b>(<i>filenames</i>)

<p>
        Public method to update the message catalogs.
</p>
<dl>

<dt><i>filenames</i> (list of str)</dt>
<dd>
list of file names
</dd>
</dl>
<a NAME="PyBabelProject.determineCapability" ID="PyBabelProject.determineCapability"></a>
<h4>PyBabelProject.determineCapability</h4>
<b>determineCapability</b>(<i></i>)

<p>
        Public method to determine the availability of flask-babel.
</p>
<a NAME="PyBabelProject.extractMessages" ID="PyBabelProject.extractMessages"></a>
<h4>PyBabelProject.extractMessages</h4>
<b>extractMessages</b>(<i></i>)

<p>
        Public method to extract the messages catalog template file.
</p>
<a NAME="PyBabelProject.getBabelCommand" ID="PyBabelProject.getBabelCommand"></a>
<h4>PyBabelProject.getBabelCommand</h4>
<b>getBabelCommand</b>(<i></i>)

<p>
        Public method to build the Babel command.
</p>
<dl>
<dt>Return:</dt>
<dd>
full pybabel command
</dd>
</dl>
<dl>
<dt>Return Type:</dt>
<dd>
str
</dd>
</dl>
<a NAME="PyBabelProject.initActions" ID="PyBabelProject.initActions"></a>
<h4>PyBabelProject.initActions</h4>
<b>initActions</b>(<i></i>)

<p>
        Public method to define the flask-babel actions.
</p>
<a NAME="PyBabelProject.initMenu" ID="PyBabelProject.initMenu"></a>
<h4>PyBabelProject.initMenu</h4>
<b>initMenu</b>(<i></i>)

<p>
        Public method to initialize the flask-babel menu.
</p>
<dl>
<dt>Return:</dt>
<dd>
the menu generated
</dd>
</dl>
<dl>
<dt>Return Type:</dt>
<dd>
QMenu
</dd>
</dl>
<a NAME="PyBabelProject.openPOEditor" ID="PyBabelProject.openPOEditor"></a>
<h4>PyBabelProject.openPOEditor</h4>
<b>openPOEditor</b>(<i>poFile</i>)

<p>
        Public method to edit the given file in an external .po editor.
</p>
<dl>

<dt><i>poFile</i> (str)</dt>
<dd>
name of the .po file
</dd>
</dl>
<a NAME="PyBabelProject.projectClosedHooks" ID="PyBabelProject.projectClosedHooks"></a>
<h4>PyBabelProject.projectClosedHooks</h4>
<b>projectClosedHooks</b>(<i></i>)

<p>
        Public method to remove our hook methods.
</p>
<a NAME="PyBabelProject.projectOpenedHooks" ID="PyBabelProject.projectOpenedHooks"></a>
<h4>PyBabelProject.projectOpenedHooks</h4>
<b>projectOpenedHooks</b>(<i></i>)

<p>
        Public method to add our hook methods.
</p>
<a NAME="PyBabelProject.registerOpenHook" ID="PyBabelProject.registerOpenHook"></a>
<h4>PyBabelProject.registerOpenHook</h4>
<b>registerOpenHook</b>(<i></i>)

<p>
        Public method to register the open hook to open a translations file
        in a translations editor.
</p>
<a NAME="PyBabelProject.updateCatalogs" ID="PyBabelProject.updateCatalogs"></a>
<h4>PyBabelProject.updateCatalogs</h4>
<b>updateCatalogs</b>(<i>filenames, withObsolete=False</i>)

<p>
        Public method to update the message catalogs.
</p>
<dl>

<dt><i>filenames</i> (list of str)</dt>
<dd>
list of filenames (not used)
</dd>
<dt><i>withObsolete</i> (bool)</dt>
<dd>
flag indicating to keep obsolete translations
</dd>
</dl>
<a NAME="PyBabelProject.updateCatalogsObsolete" ID="PyBabelProject.updateCatalogsObsolete"></a>
<h4>PyBabelProject.updateCatalogsObsolete</h4>
<b>updateCatalogsObsolete</b>(<i>filenames</i>)

<p>
        Public method to update the message catalogs keeping obsolete
        translations.
</p>
<dl>

<dt><i>filenames</i> (list of str)</dt>
<dd>
list of filenames (not used)
</dd>
</dl>
<a NAME="PyBabelProject.updateSelectedCatalogs" ID="PyBabelProject.updateSelectedCatalogs"></a>
<h4>PyBabelProject.updateSelectedCatalogs</h4>
<b>updateSelectedCatalogs</b>(<i>filenames, withObsolete=False</i>)

<p>
        Public method to update the selected message catalogs.
</p>
<dl>

<dt><i>filenames</i> (list of str)</dt>
<dd>
list of filenames
</dd>
<dt><i>withObsolete</i> (bool)</dt>
<dd>
flag indicating to keep obsolete translations
</dd>
</dl>
<a NAME="PyBabelProject.updateSelectedCatalogsObsolete" ID="PyBabelProject.updateSelectedCatalogsObsolete"></a>
<h4>PyBabelProject.updateSelectedCatalogsObsolete</h4>
<b>updateSelectedCatalogsObsolete</b>(<i>filenames</i>)

<p>
        Public method to update the message catalogs keeping obsolete
        translations.
</p>
<dl>

<dt><i>filenames</i> (list of str)</dt>
<dd>
list of filenames (not used)
</dd>
</dl>
<div align="right"><a href="#top">Up</a></div>
<hr />
</body></html>

eric ide

mercurial