Commit Graph

51 Commits

Author SHA1 Message Date
songwenping 342d388803 Remove unnecessary unicode prefixes
Change-Id: Ia75cc0c9fd5117b22b54fe872b28a4164faedf9a
2022-04-19 19:31:26 +08:00
Hervé Beraud 05356e6ac8 Adding pre-commit
Introduced changes:
- pre-commit config and rules
- Add pre-commit to pep8 gate, Flake8 is covered in the pre-commit hooks.
- Applying fixes for pre-commit compliance in all code.

Also commit hash will be used instead of version tags in pre-commit to
prevend arbitrary code from running in developer's machines.

pre-commit will be used to:
- trailing whitespace;
- Replaces or checks mixed line ending (mixed-line-ending);
- Forbid files which have a UTF-8 byte-order marker (check-byte-order-marker);
- Checks that non-binary executables have a proper
  shebang (check-executables-have-shebangs);
- Check for files that contain merge conflict strings (check-merge-conflict);
- Check for debugger imports and py37+ breakpoint()
  calls in python source (debug-statements);
- Attempts to load all yaml files to verify syntax (check-yaml);
- Run flake8 checks (flake8) (local)

For further details about tests please refer to:
https://github.com/pre-commit/pre-commit-hooks

Change-Id: I093ca79022578b99bdb3ef78e887eef9bc3310ad
Signed-off-by: Moisés Guimarães de Medeiros <moguimar@redhat.com>
2020-09-22 10:27:36 +02:00
Zuul 761ce99588 Merge "Add release notes links to doc index" 2020-06-03 10:15:09 +00:00
Andreas Jaeger 8c60d4261e Switch to newer openstackdocstheme and reno versions
Switch to openstackdocstheme 2.2.1 and reno 3.1.0 versions. Using
these versions will allow especially:
* Linking from HTML to PDF document
* Allow parallel building of documents
* Fix some rendering problems

Update Sphinx version as well.

openstackdocstheme renames some variables, so follow the renames. A
couple of variables are also not needed anymore, remove them.

Set openstackdocs_auto_name to use project as name.

Change pygments_style to 'native' since old theme version always used
'native' and the theme now respects the setting and using 'sphinx' can
lead to some strange rendering.

See also
http://lists.openstack.org/pipermail/openstack-discuss/2020-May/014971.html

Change-Id: I129fcb2f17f7938b72fa788afa99004cc0be1d84
2020-05-21 13:43:40 +00:00
Hervé Beraud 3df98e2a5c Add release notes links to doc index
Change-Id: If197185feabdefda36c3cddf3aef1327c5eaed5f
2020-04-16 17:23:14 +02:00
Hervé Beraud 281fd591e7 [ussuri][goal] Drop python 2.7 support and testing
OpenStack is dropping the py2.7 support in Ussuri cycle.

Complete discussion & schedule can be found in
-
http://lists.openstack.org/pipermail/openstack-discuss/2019-October/010142.html
- https://etherpad.openstack.org/p/drop-python2-support

Ussuri Communtiy-wide goal:
https://governance.openstack.org/tc/goals/selected/ussuri/drop-py27.html

Change-Id: I340a7909c49e7d2a8c82c668cbdaf9ced7196f67
Sem-Ver: api-break
2020-02-06 10:23:19 +01:00
Stephen Finucane 3b773fb717 Integrate sphinxcontrib-apidoc
This was missed in change Ice407c712b5438b06c4f439c73946640a0c5a86d.
While we're here, we clean up some other bits of mess that were left
behind by that.

Change-Id: Id061758834eaf266766ab7344c4547fce4261e89
2019-12-17 16:36:08 +00:00
caoyuan 0d76d2cb30 tox: Keeping going with docs
Sphinx 1.8 introduced [1] the '--keep-going' argument which, as its name
suggests, keeps the build running when it encounters non-fatal errors.
This is exceptionally useful in avoiding a continuous edit-build loop
when undertaking large doc reworks where multiple errors may be
introduced.

[1] https://github.com/sphinx-doc/sphinx/commit/e3483e9b045

Change-Id: If8c19a7d5d2a6ca089efb6c19d81a277aba7f06d
2019-10-24 14:56:26 +08:00
Adam Spiers a6e330857b Move doc related modules to doc/requirements.txt
Change-Id: Ice407c712b5438b06c4f439c73946640a0c5a86d
2019-07-05 17:40:32 +00:00
Adam Spiers 7934e6f405 Clarify that translation strings are extracted via source inspection
Make it clearer why the function argument to _() etc. has to be a
string, by explicitly mentioning source inspection, as suggested by
Doug:

https://review.opendev.org/#/c/664670/1/doc/source/user/guidelines.rst@164

Change-Id: I87212a709b9e474238f4a4feca5ed806cfb4bd49
2019-06-12 12:14:41 +01:00
Adam Spiers 746be6362b Fix guidelines w.r.t. translation of log messages
Translation of log messages was ceased starting with Pike, but these
guidelines were only partially updated (by Ia34ad79ca9), with a small
warning block buried in the middle of a long page of unchanged
guidelines which it somewhat contradicted.

So update the rest of the page to align with current best practices in
order to avoid confusion.

Also summarise the primary reasons for the change in policy, so that
curious readers don't have to trawl through long email threads to find
out.

Change-Id: Ib86013ff5e7bd07ddc696da2e4c56ce9d07f0cb6
2019-06-12 12:11:50 +01:00
Ben Nemec a38f70d463 Remove references to log translation functions
No new implementers of this library should be using the log-oriented
marker functions, so we shouldn't be providing examples of them.
This change removes them from the sample integration module and
updates the usage examples to reflect the current best practices.

Change-Id: I0ae89cb3500821465438ee1f5572ab5e3573044c
2018-09-12 22:23:49 +00:00
melissaml 2a12533a02 Trivial: Update pypi url to new url
Pypi url changed from [1] to [2]

[1] https://pypi.python.org/pypi/<package>
[2] https://pypi.org/project/<package>

Change-Id: Ic3dd7d69451fe7f3dee0f65ed71f55c330722065
2018-04-21 12:17:43 +08:00
ChangBo Guo(gcb) 2db67df0d0 Update URLs in documents according to document migration
Change-Id: Ib92b989c48553675dafc1ec44fdb43a4155e2a01
2017-07-12 15:47:32 +08:00
Doug Hellmann da9de62db0 switch from oslosphinx to openstackdocstheme
Change-Id: I0169e752c5043ff488c9917cf72c9bb57e866c2f
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
2017-06-29 14:30:24 -04:00
Doug Hellmann 01dead7bdd rearrange the documentation to fit into the new standard layout
Change-Id: Ibe6548b444a8f030ea7ba034b7d63622e32d3917
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
2017-06-29 14:30:08 -04:00
Doug Hellmann f294b2d505 add notes about skipping log translation setup
Now that we have decided to skip log translations, let's stop telling
people to set them up. This change adds a note saying the work is not
needed, but leaves the instructions so that someone trying to understand
existing code can review them. The actual translation functions will be
marked for deprecation in the future, when enough projects have dropped
using them to warrant that change.

Change-Id: Ia34ad79ca9c6d1ea862b6954669c992a898a03ff
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
2017-03-17 10:41:07 -04:00
Jenkins c3682ff303 Merge "Add docs on how to display translated strings in your app" 2016-11-09 18:29:47 +00:00
howardlee fec1b27651 Typo fix in oslo.i18n
TrivialFix

Change-Id: Ie578d3527cb06abe31f63f20ef46676dbd96d333
2016-11-01 16:39:42 +08:00
Akihiro Motoki ccc357e0a2 Add docs on how to display translated strings in your app
This commit documents tips on how to display translated strings.
It covers envvar usage on locale directory and preferred languages.

Change-Id: Icf5618954500e56e3de087d4f369dbd72c54c564
2016-10-02 03:55:23 +09:00
ChangBo Guo(gcb) e749d84f3b doc: contextual/plural translation requires oslo.i18n >=2.1.0
We introduced contextual/plural translation in version 2.1.0,
so declare this in documentation to avoid AttributeError.

Change-Id: Iadc24d19e2a2b799a5009a806ee7c64867b1d554
Related-Bug: #1525992
2015-12-23 11:09:03 +08:00
Akihiro Motoki 66a08459bc [doc] Update _i18n.py example to pass pep8
It would be nice if the _i18n.py example can be copy-and-paste
to myapp/_i18n.py without pep8 errors.

Change-Id: I9ff4174ba1cac56c8b20ba572757fb54baa1e9bb
2015-11-28 15:51:50 +09:00
Ronald Bradford 19974b3661 Improved integration module documentation
. Updated example to define DOMAIN and get_available_languages()
  as seen in several projects.
. Ensured myapp is consistent in various examples.
. Emphasized note on private naming implementation.
. Updated example to show get_available_languages().

Change-Id: I2f925a7631677aa0534de668a617458febf0bb08
2015-11-11 11:20:52 -05:00
Joshua Harlow 36dabf19b2 Move 'history' -> release notes section
This seems to better match what the other oslo
libraries are calling this section, so we might as
well call it that to.

Change-Id: Ib8b0fb687815d98c2257105ffb7da0cf9d3d21fb
2015-09-25 11:47:39 -07:00
Jenkins f2570c1475 Merge "Support contextual and plural form of gettext functions" 2015-07-06 09:08:42 +00:00
Peng Wu 9e3132bc2f Support contextual and plural form of gettext functions
This draft patch is created for more-gettext-support blueprint review.

Refer URL:
https://blueprints.launchpad.net/oslo.i18n/+spec/more-gettext-support
https://review.openstack.org/#q,topic:bp/more-gettext-support,n,z

Implements: blueprint more-gettext-support

Depends-on: I258eac447ecc7b71fb02952077cf3ef3ecfe12bb

Change-Id: Ic16d902ddfe94cfb5cfabe1c4f612ff001a8fa53
2015-07-01 14:56:54 +08:00
Doug Hellmann 191e49095e clarify translation policy
Update the policy about which changes should be translated based on the
cross-project meeting from 2015-06-30.

Change-Id: Id32e3aa0f117920c28afdeb04e5bd553af4e0629
2015-06-30 21:29:04 +00:00
Jenkins f92f45ca07 Merge "Update guideline doc of multiple use msg case" 2015-05-15 14:20:29 +00:00
Jenkins 3e3ce417ed Merge "Misplaced parenthesis causing confusion" 2015-05-14 22:34:47 +00:00
Sean McGinnis 01fd79d3a5 Misplaced parenthesis causing confusion
The current example in the guidelines for using translation markers
has the closing parenthesis including the string as well as the
formatting argument. This has caused some confusion in reviews where
someone incorrectly follows this pattern and ends up with pep8 errors.

This patch corrects the closing parenthesis placement for both examples
in the "Avoid Forcing the Tranlation of Translatable Variable" section.

Change-Id: I5cd80c3ebec57a7e3686cac946427f7b6e6f3d6d
2015-05-06 08:51:53 -05:00
James Carey b91fcb32f1 Update guideline doc of multiple use msg case
There was confusion in a cinder review with respect
to the case where a message is used both in a log
and in an exception:
https://review.openstack.org/#/c/155894/2

This update is to clarify the guidelines to help
prevent similar confusion in the future.

Change-Id: Ia26b4d3efafb8ad13c45e982a1be7aea176417e1
2015-02-24 22:23:36 +00:00
Doug Hellmann 651c325909 Improve fixture documentation
Include the special members so the constructor parameters are listed.

Change-Id: Id5df1d7690e7a29a9a535820fb4c898d71a84257
2015-01-07 19:47:04 +00:00
Doug Hellmann ba05e9a9b9 Move out of the oslo namespace package
Move the public API out of oslo.i18n to oslo_i18n. Retain the ability to
import from the old namespace package for backwards compatibility for
this release cycle.

bp/drop-namespace-packages

Change-Id: I800f121c271d8e69f6e776c4aef509bbb8008170
2014-12-18 16:35:03 -05:00
Doug Hellmann 53635eae0f Force code sample to be treated as python
Change-Id: I3340397e0b263973aa8387d77d50cc1cb4756634
Closes-Bug: #1374477
2014-12-04 11:42:13 -05:00
Doug Hellmann 1fc63ac076 Add note for integration modules in libraries
Add a note on naming the new integration module being added to a
library.

Change-Id: I1d713bcb05a1b42f29cce59077c640885e6e0069
2014-11-12 10:59:44 -05:00
James Carey 9b6a9c2db5 Make clear in docs to use _LE() when using LOG.exception()
Added note to guidelines.rst about this case and added an example
in usage.rst.

Closes-Bug: #1378053
Change-Id: Ie29441e0f354aab2b04d731dc5d597390b89783d
2014-10-07 16:12:30 +00:00
Jenkins 32740b0e23 Merge "Use same indentation in doc/source/usage" 2014-10-04 03:14:23 +00:00
ZhiQiang Fan 26edee1f7f Use same indentation in doc/source/usage
The first code example for "Creating an Integration Module"
(http://docs.openstack.org/developer/oslo.i18n/usage.html) is not
rendered correctly, it is because the wrong indentation.

This patch corrects this mistake, and uses a same indentation in cross
of the whole file.

Change-Id: I74189de25d3611ed6a57cf35fee6682b81056071
Closes-Bug: #1374477
2014-09-27 00:13:50 +08:00
David Stanek f721da76f2 Fixes a small syntax error in the doc examples
Change-Id: I2683c22f77b17ca6f7be66fd9ba8ded0e547d981
2014-09-11 17:44:41 +00:00
Jenkins b37376b568 Merge "Document how to add import exceptions" 2014-08-27 00:54:54 +00:00
Doug Hellmann 688076eb69 Document how to add import exceptions
Add documentation for how to add import exceptions so hacking does not
complain about the way the library is used.

Change-Id: Ic33307215abbc38d3d3d2435588f79dc115510fd
2014-08-23 15:03:16 -04:00
Doug Hellmann a9d8efcf6c Add a test fixture for translatable strings
Change-Id: I96aec806392672ff69a3af6c3e0a04a621656f78
2014-08-12 11:35:30 -04:00
Jenkins c9d841bd0f Merge "Add Changelog to the documentation" 2014-07-14 21:25:32 +00:00
Jenkins a3e5c8cbbe Merge "Add links to policy discussions" 2014-07-12 21:40:25 +00:00
Rosario Di Somma 56af406261 Add Changelog to the documentation
Include the ChangeLog generated by pbr in the documentation

Closes-Bug: 1336974

Change-Id: I2f2cb935dc52d5d0e9ddc4439a0022f739776f45
Signed-off-by: Rosario Di Somma <rosario.disomma@dreamhost.com>
2014-07-11 22:53:22 +01:00
Doug Hellmann 490466b2a2 Shift public API to top level package
Rather than forcing everyone to say "from oslo.i18n import gettextutils"
allow "from oslo import i18n".

Change-Id: If87182beb8c7fa6a12f7a1524fdda4910b4e19d5
2014-06-27 12:26:57 -07:00
Doug Hellmann 4313fa17c4 Add links to policy discussions
Start building up a list of links to the history of the policy
discussions about internationalization and translation. This list is not
yet complete, and other links can be added in later changesets.

Change-Id: I5a5dc636a6612dc13c0fdea765fc89083f282cfc
2014-06-26 15:17:13 -04:00
Doug Hellmann 5ce463c433 Improve initial documentation
Provide more detailed guidelines based on the info we have in the
wiki at https://wiki.openstack.org/wiki/LoggingStandards#Guidelines

Provide API documentation for the gettextutils module.

Fix up some formatting issues with the contributing page that kept it
from being included in the table of contents.

Add a description to the README.

Other minor section and document title fixes, and remove unused pages.

Change-Id: I1e0a2be2918fe8f5d4194fc5a82b19edb225c1d0
2014-06-23 13:17:45 -04:00
Doug Hellmann 67ac9babdf Check the lazy flag at runtime
Update lazy flag handling to check it at runtime when each message is
translated, instead of once at startup when the translation function is
created. This allows a library to support lazy translation, without
requiring an application that uses the library to support it.

Change-Id: Iae22668119c8d0f5fb9c486436bfc35cdb88ac58
2014-06-04 12:44:10 -07:00
Doug Hellmann 0e4a3db114 Fix up usage instructions
Clean up the documentation a little bit and write slightly
more verbose (and correct) instructions for using the library.

bp graduate-oslo-i18n

Change-Id: Ice626b6eae3c02be84cf79a1ad57817ec8736d8a
2014-05-07 12:43:47 -07:00