diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index 132fcba7..50a353e3 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -70,7 +70,7 @@ Ready to contribute? Here's how to set up `xscen` for local development. $ mamba env create -f environment-dev.yml $ pip install -e . -3. As xscen was installed in editable mode, we also need to compile the translation catalogs manuall: +3. As xscen was installed in editable mode, we also need to compile the translation catalogs manually: $ make translate @@ -120,13 +120,13 @@ Ready to contribute? Here's how to set up `xscen` for local development. Translating xscen ~~~~~~~~~~~~~~~~~ -If your additions to xscen play with plain text dataset attributes like "long_name" or "description", you should also provide -french translations for those fields. To manage translations, xscen uses python's `gettext` with the help of `babel`. +If your additions to xscen play with plain text attributes like "long_name" or "description", you should also provide +French translations for those fields. To manage translations, xscen uses python's `gettext` with the help of `babel`. To update an attribute while enabling translation, use py:func:`utils.add_attr` instead of a normal set-item. For example: .. code python - ds.attrs['description'] = "The english description" + ds.attrs['description'] = "The English description" becomes @@ -138,14 +138,14 @@ becomes add_attr(ds, "description", _("English description of {a}"), a="var") -See also :py:func:`update_attr` for the special case where an attribute is updated using the previous version. +See also :py:func:`update_attr` for the special case where an attribute is updated using its previous version. -Once the code is implemented and translatable strings marked as such, we need to extract them and catalog them -in the french translation map. From the root directory of xscen, run:: +Once the code is implemented and translatable strings are marked as such, we need to extract them and catalog them +in the French translation map. From the root directory of xscen, run:: $ make findfrench -Then go edit ``xscen/xscen/data/fr/LC_MESSAGES/xscen.po`` with the correct french translations. Finally, running:: +Then go edit ``xscen/xscen/data/fr/LC_MESSAGES/xscen.po`` with the correct French translations. Finally, running:: $ make translate diff --git a/Makefile b/Makefile index fe2453b8..c57529b3 100644 --- a/Makefile +++ b/Makefile @@ -90,7 +90,7 @@ dist: clean ## builds source and wheel package install: clean ## install the package to the active Python's site-packages python setup.py install -findfrench: ## Extract phrases and update the french translation catalog (this doesn't translate) +findfrench: ## Extract phrases and update the French translation catalog (this doesn't translate) python setup.py extract_messages python setup.py update_catalog -l fr diff --git a/docs/goodtoknow.rst b/docs/goodtoknow.rst index 797db229..f92c5471 100644 --- a/docs/goodtoknow.rst +++ b/docs/goodtoknow.rst @@ -48,7 +48,7 @@ What is currently not covered by either `xscen` or `xclim` is a method to resamp Metadata translation -------------------- -xscen itself does not add many translatable attributes, but when it does it will look into xclim's options for which locales to translate them too. In a config file, activating french translation for xclim's indicators but also for xscen is done with : +xscen itself does not add many translatable attributes, but when it does, it will look into xclim's options for which locales to translate them to. In a config file, activating French translations for both xclim's indicators and xscen is done with : .. code-block:: yaml @@ -56,12 +56,12 @@ xscen itself does not add many translatable attributes, but when it does it will metadata_locales: - fr -Note that this only applies to attributes that are added to a dataset. Some xscen functions will only update an attribute. For example, when calculating the climatology of a variable with `long_name` `Mean temperature`, :py:func:`climatological_mean` will update the `long_name` as `30-year average of Mean temperature`. This automatic update is done for all locales available in the variable, no matter what xclim option is activated. +Note that this only applies to attributes that are added to a dataset. Some xscen functions will instead update an existing attribute. For example, when calculating the climatology of a variable with `long_name` `Mean temperature`, :py:func:`climatological_mean` will update the `long_name` as `30-year average of Mean temperature`. This automatic update is done for all locales available in the variable, no matter what xclim option is activated. -Module wide options +Module-wide options ------------------- -As seen above, it can be useful to use the "special" sections of the config file to set some module wide options. For example: +As seen above, it can be useful to use the "special" sections of the config file to set some module-wide options. For example: .. code-block:: yaml diff --git a/xscen/utils.py b/xscen/utils.py index 28418e3c..38723448 100644 --- a/xscen/utils.py +++ b/xscen/utils.py @@ -64,7 +64,7 @@ def update_attr(ds, attr, new, others=None, **fmt): - """Format a dataset attribute referencing itself in a translatable way. + """Format an attribute referencing itself in a translatable way. Parameters ----------