Git Product home page Git Product logo

zope.i18nmessageid's Introduction

zope.i18nmessageid

Latest Version Documentation Status

To translate any text, we must be able to discover the source domain of the text. A source domain is an identifier that identifies a project that produces program source strings. Source strings occur as literals in python programs, text in templates, and some text in XML data. The project implies a source language and an application context.

We can think of a source domain as a collection of messages and associated translation strings.

We often need to create unicode strings that will be displayed by separate views. The view cannot translate the string without knowing its source domain. A string or unicode literal carries no domain information, therefore we use messages. Messages are unicode strings which carry a translation source domain and possibly a default translation. They are created by a message factory. The message factory is created by calling MessageFactory with the source domain.

This package provides facilities for declaring such messages within program source text; translation of the messages is the responsiblitiy of the 'zope.i18n' package.

Please see http://zopei18nmessageid.readthedocs.org/en/latest/ for the documentation.

zope.i18nmessageid's People

Contributors

tseaver avatar mgedmin avatar dataflake avatar jamadden avatar mcdonc avatar nyergler avatar thefunny42 avatar hannosch avatar baijum avatar freddrake avatar georgyberdyshev avatar regebro avatar y-fujisaki2 avatar faassen avatar tranchitella avatar agroszer avatar nadako avatar felixonmars avatar jugmac00 avatar icemac avatar projekt01 avatar srichter avatar strichter avatar wosc avatar

Stargazers

Kevin Alexander Scott Jellis avatar

Watchers

Bradley Dean avatar David Glick avatar Ethan Jucovy avatar TsungWei Hu avatar Fernando Correa Neto avatar Vincent Fretin avatar Rodrigo Ferreira de Souza avatar  avatar Christian Klinger avatar Mauro Amico avatar Atsushi Odagiri avatar  avatar Thierry Florac avatar Takeshi Yamamoto avatar Thomas Desvenain avatar  avatar Peter Holzer avatar  avatar Rudá Porto Filgueiras avatar Davi Medeiros avatar Philip Bauer avatar Fulvio Casali avatar Casey Duncan avatar Manabu TERADA avatar Jérome Perrin avatar Jan-Wijbrand Kolman avatar Jean-Philippe Camguilhem  avatar Christian Zagrodnick avatar  avatar  avatar Georg Gogo. BERNHARD avatar James Cloos avatar Chris Calloway avatar  avatar Juan Carlos Coruña avatar  avatar Laurent Lasudry avatar Harald Friessnegger avatar nilo avatar Gil Forcada Codinachs avatar  avatar  avatar Gauthier Bastien avatar Alessandro Pisa avatar Uwe Oestermeier avatar  avatar Paul Sephton avatar Ulrich Eck avatar Lur Ibargutxi avatar Christian Tismer-Sperling avatar Yusei Tahara avatar Robert Kuzma avatar Wesley Barroso Lopes avatar  avatar  avatar Ján Jockusch avatar Vivian ANTOINE avatar Jeremy Kolbe avatar Christian Meier avatar  avatar Dieter Maurer avatar Filippo Campi avatar  avatar Jan Mevissen avatar Marcel Liebischer avatar Viktor Dick avatar  avatar

zope.i18nmessageid's Issues

six seems to be unused

BUG/PROBLEM REPORT / FEATURE REQUEST

What I did:

grep -R six ;-)

What I expect to happen:

Ideally, no dependency on six, or at least code using six.

What actually happened:

It seems that six is a declared as a dependency but it's not used anywhere in the code.

What version of Python and Zope/Addons I am using:

Gentoo Linux, Python 3.11.2, zope-i18nmessageid 6.0.0

Python 'Message.__setattr__' implementation raises the wrong error for the '_readonly' case

The py3x-pure tests don't fail due to #28, but this bug causes the pypy3 doctests to fail on master:

$ tox -re pypy3
...
pypy3: commands[1]> sphinx-build -b doctest -d /home/tseaver/projects/Zope/Z3/zope.i18nmessageid/.tox/pypy3/.cache/doctrees docs /home/tseaver/projects/Zope/Z3/zope.i18nmessageid/.tox/pypy3/.cache/doctest
...
running tests...

Document: narr
--------------
**********************************************************************
File "narr.rst", line 96, in default
Failed example:
    robot.domain = "planetexpress"
Expected:
    Traceback (most recent call last):
    ...
    AttributeError: readonly attribute
Got:
    Traceback (most recent call last):
      File "/opt/pypy3.10-v7.3.16-linux64/lib/pypy3.10/doctest.py", line 1352, in __run
        exec(compile(example.source, filename, "single",
      File "<doctest default[0]>", line 1, in <module>
        robot.domain = "planetexpress"
      File "/home/tseaver/projects/Zope/Z3/zope.i18nmessageid/src/zope/i18nmessageid/message.py", line 79, in __setattr__
        raise TypeError('readonly attribute')
    TypeError: readonly attribute
**********************************************************************
File "narr.rst", line 101, in default
Failed example:
    robot.default = u"${name} is not a robot."
Expected:
    Traceback (most recent call last):
    ...
    AttributeError: readonly attribute
Got:
    Traceback (most recent call last):
      File "/opt/pypy3.10-v7.3.16-linux64/lib/pypy3.10/doctest.py", line 1352, in __run
        exec(compile(example.source, filename, "single",
      File "<doctest default[1]>", line 1, in <module>
        robot.default = u"${name} is not a robot."
      File "/home/tseaver/projects/Zope/Z3/zope.i18nmessageid/src/zope/i18nmessageid/message.py", line 79, in __setattr__
        raise TypeError('readonly attribute')
    TypeError: readonly attribute
**********************************************************************
File "narr.rst", line 106, in default
Failed example:
    robot.mapping = {'name': 'Bender'}
Expected:
    Traceback (most recent call last):
    ...
    AttributeError: readonly attribute
Got:
    Traceback (most recent call last):
      File "/opt/pypy3.10-v7.3.16-linux64/lib/pypy3.10/doctest.py", line 1352, in __run
        exec(compile(example.source, filename, "single",
      File "<doctest default[2]>", line 1, in <module>
        robot.mapping = {'name': 'Bender'}
      File "/home/tseaver/projects/Zope/Z3/zope.i18nmessageid/src/zope/i18nmessageid/message.py", line 79, in __setattr__
        raise TypeError('readonly attribute')
    TypeError: readonly attribute
**********************************************************************
1 items had failures:
   3 of  35 in default
35 tests in 1 items.
32 passed and 3 failed.
***Test Failed*** 3 failures.

Doctest summary
===============
   35 tests
    3 failures in tests
    0 failures in setup code
    0 failures in cleanup code
build finished with problems, 1 warning.
pypy3: exit 1 (2.17 seconds) /home/tseaver/projects/Zope/Z3/zope.i18nmessageid> sphinx-build -b doctest -d /home/tseaver/projects/Zope/Z3/zope.i18nmessageid/.tox/pypy3/.cache/doctrees docs /home/tseaver/projects/Zope/Z3/zope.i18nmessageid/.tox/pypy3/.cache/doctest pid=94066
pypy3: FAIL ✖ in 7.6 seconds

Set up Appveyor to build and upload Windows wheels to PyPI

Checklist from zopefoundation/zope.proxy#24

  • a copy of appveyor.yml from zope.interface or similar
  • someone with an Appveyor account (e.g. me) to enable this project
  • encrypted PyPI upload credentials in the appveyor.yml (no change required from the copy in zope.interface if I'm the one who enables the Appveyor account)
  • grant zope.wheelbuilder PyPI rights
  • push the appveyor.yml commit to master
  • (optionally) a push of a temporary branch that builds and uploads zope.i18nmessageid 4.1.0 wheels

Support PURE_PYTHON

Currently, the C extension is unconditionally imported:

try:
from ._zope_i18nmessageid_message import Message
except ImportError: # pragma: no cover
pass

This makes it difficult to test the Python implementation on CPython; you have to remove the dynamic library.

Most Zope projects that have a C extension respect a PURE_PYTHON=1 environment variable to disable importing the C extension. This project should as well.

(See #27 (comment))

sdist on PyPI broken with new setuptools

Similar to zopefoundation/zope.interface#184. This breaks, for example, PyPy3 builds: https://travis-ci.org/zopefoundation/zope.container/jobs/660521875#L268

Collecting zope.i18nmessageid
  Downloading zope.i18nmessageid-5.0.0.tar.gz (28 kB)
    ERROR: Command errored out with exit status 1:
     command: /home/travis/virtualenv/pypy3.6-7.1.1/bin/pypy3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-rd8qof6w/zope.i18nmessageid/setup.py'"'"'; __file__='"'"'/tmp/pip-install-rd8qof6w/zope.i18nmessageid/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-install-rd8qof6w/zope.i18nmessageid/pip-egg-info
         cwd: /tmp/pip-install-rd8qof6w/zope.i18nmessageid/
    Complete output (5 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-rd8qof6w/zope.i18nmessageid/setup.py", line 25, in <module>
        from setuptools import setup, find_packages, Extension, Feature
    ImportError: cannot import name 'Feature'
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

I think we just need to publish a new release, code in master has removed this.

C/Python consitency: C doesn't convert `default` to unicode

The C implementation will happily keep and return whatever object you provide for default. But Python forces it to be unicode by calling unicode(default).

If the default is not unicode already, this can cause issues. Some of them are noisy (a UnicodeDecodeError on Python 2) but on Python 3, especially, it's possible to get things like "b'abc'" because unicode is just str.

It seems to me that the Python implementation should not force the default to be unicode (easiest). Alternatively, they should both force it to unicode.

This came up in zopefoundation/zope.app.locales#4, because there is a test case that explicitly wants to use bytes for the default ("default might be a string with the DEFAULT_ENCODING---8bit").

RFE: is it possible to start making github releases?🤔

On create github release entry is created email notification to those whom have set in your repo the web UI Watch->Releases.
gh release can contain additional comments (li changelog) or additional assets like release tar balls (by default it contains only assets from git tag) however all those part are not obligatory.
In simplest variant gh release can be empty because subiekt of the sent email contains git tag name.

I'm asking because my automation process uses those email notifications by trying to make preliminary automated upgrades of building packages, which allows saving some time on maintaining packaging procedures.
Probably other people may be interested to be instantly informed about release new version as well.

Documentation and examples of generate gh releases:
https://docs.github.com/en/repositories/releasing-projects-on-github/managing-releases-in-a-repository
https://cli.github.com/manual/gh_release_upload/
jbms/sphinx-immaterial#282
https://github.com/marketplace/actions/github-release
https://pgjones.dev/blog/trusted-plublishing-2023/
jbms/sphinx-immaterial#281 (comment)
tox target to publish on pypi and make gh release https://github.com/jaraco/skeleton/blob/928e9a86d61d3a660948bcba7689f90216cc8243/tox.ini#L42-L58

Regression in 4.3 Python impl: NoneType object is not subscriptable

Seen running the zope.app.apidoc tests, but probably also shows up with zope.app.preference. The same tests pass with 4.2 and under CPython:

      File "//pypy/site-packages/zope/app/apidoc/browser/preference.py", line 40, in __init__
        super(ApidocEditPreferenceGroup, self).__init__(context, request)
      File "//pypy/site-packages/zope/app/preference/browser.py", line 84, in __init__
        self.label = Message(pref_msg, mapping={u'name': name})
      File "//pypy/site-packages/zope/i18nmessageid/message.py", line 41, in __new__
        default = ustr.default[:] if default is _marker else default
    TypeError: 'NoneType' object is not subscriptable

5.1.0 release is missing sdist (and non-Windows wheels)

The newest 5.1.0 release of zope.i18nmessageid lacks the sdist tarball and features only Windows wheels. This makes it impossible to install it via pip on any other platform, i.e.:

$ pip install zope.i18nmessageid==5.1.0
ERROR: Could not find a version that satisfies the requirement zope.i18nmessageid==5.1.0 (from versions: 3.4dev-r73161, 3.4.0, 3.4.2, 3.4.3, 3.5.0, 3.5.1, 3.5.2, 3.5.3, 3.6.0, 3.6.1, 4.0.0, 4.0.1, 4.0.2, 4.0.3, 4.1.0, 4.2, 4.3, 4.3.1, 5.0.0, 5.0.1)
ERROR: No matching distribution found for zope.i18nmessageid==5.1.0

Add support to release aarch64 wheels

Problem

On aarch64, 'pip install zope-i18nmessageid' builds the wheels from source code and then install it. It requires the user to have development environment installed on his system. Also, it take some time to build the wheels than downloading and extracting the wheels from PyPi.

Resolution

On aarch64, pip install zope-i18nmessageid' should download the wheels from PyPi

@mgedmin, Please let me know your interest on releasing aarch64 wheels. I can help in this.

Docs build raises a Sphinx warning under 7.x, would break under 8.x

$ tox -e docs
...
docs: commands[0]> sphinx-build -b html -d docs/_build/doctrees docs docs/_build/html
Running Sphinx v7.3.7
WARNING: The pre-Sphinx 1.0 'intersphinx_mapping' format is deprecated and will be removed in Sphinx 8. Update to the current format as described in the documentation. Hint: "intersphinx_mapping = {'<name>': ('http://docs.python.org/', None)}".https://www.sphinx-doc.org/en/master/usage/extensions/intersphinx.html#confval-intersphinx_mapping
---

Fix process of reference count during GC

When we subtract reference counter of an object, the destructor is automatically called if the value of counter is 0.
At the same time an error occurs, as the GC executed while the destructor is still in running phase.
To eliminate the error, we have added below program which exclude objects from GC in the destructor in line 4.

static void
Wrapper_dealloc(Wrapper *self)
{
PyObject_GC_UnTrack((PyObject )self); //Add this line to eliminate self from GC
Wrapper_clear(self);
self->ob_type->tp_free((PyObject
)self);
}

Patch: zope.i18nmessageid.zip

5.0.1: sphinx warnings `reference target not found`

On building my packages I'm using sphinx-build command with -n switch which shows warmings about missing references. These are not critical issues.
Here is the output with warnings:

+ /usr/bin/sphinx-build -n -T -b man docs build/sphinx/man
Running Sphinx v4.5.0
making output directory... done
loading intersphinx inventory from http://docs.python.org/objects.inv...
intersphinx inventory has moved: http://docs.python.org/objects.inv -> https://docs.python.org/3/objects.inv
building [mo]: targets for 0 po files that are out of date
building [man]: all manpages
updating environment: [new config] 4 added, 0 changed, 0 removed
reading sources... [100%] narr
WARNING: autodoc: failed to import module 'i18nmessageid.message' from module 'zope'; the following exception was raised:
No module named 'zope.i18nmessageid'
looking for now-outdated files... none found
pickling environment... done
checking consistency... done
writing... python-zope-i18nmessageid.3 { narr api hacking } /home/tkloczko/rpmbuild/BUILD/zope.i18nmessageid-5.0.1/docs/index.rst:1: WARNING: py:mod reference target not found: zope.i18nmessageid
/home/tkloczko/rpmbuild/BUILD/zope.i18nmessageid-5.0.1/docs/narr.rst:1: WARNING: py:mod reference target not found: zope.i18nmessageid
/home/tkloczko/rpmbuild/BUILD/zope.i18nmessageid-5.0.1/docs/narr.rst:24: WARNING: py:class reference target not found: zope.i18nmessageid.message.Message
/home/tkloczko/rpmbuild/BUILD/zope.i18nmessageid-5.0.1/docs/narr.rst:35: WARNING: py:class reference target not found: zope.i18nmessageid.message.MessageFactory
/home/tkloczko/rpmbuild/BUILD/zope.i18nmessageid-5.0.1/docs/api.rst:1: WARNING: py:mod reference target not found: zope.i18nmessageid
/home/tkloczko/rpmbuild/BUILD/zope.i18nmessageid-5.0.1/docs/api.rst:4: WARNING: py:mod reference target not found: zope.i18nmessageid.message
/home/tkloczko/rpmbuild/BUILD/zope.i18nmessageid-5.0.1/docs/hacking.rst:1: WARNING: py:mod reference target not found: zope.i18nmessageid
/home/tkloczko/rpmbuild/BUILD/zope.i18nmessageid-5.0.1/docs/hacking.rst:8: WARNING: py:mod reference target not found: zope.i18nmessageid
/home/tkloczko/rpmbuild/BUILD/zope.i18nmessageid-5.0.1/docs/hacking.rst:75: WARNING: py:mod reference target not found: nose
/home/tkloczko/rpmbuild/BUILD/zope.i18nmessageid-5.0.1/docs/hacking.rst:75: WARNING: py:mod reference target not found: coverage
/home/tkloczko/rpmbuild/BUILD/zope.i18nmessageid-5.0.1/docs/hacking.rst:89: WARNING: py:mod reference target not found: coverage
/home/tkloczko/rpmbuild/BUILD/zope.i18nmessageid-5.0.1/docs/hacking.rst:112: WARNING: py:mod reference target not found: zope.i18nmessageid
/home/tkloczko/rpmbuild/BUILD/zope.i18nmessageid-5.0.1/docs/hacking.rst:112: WARNING: py:mod reference target not found: Sphinx
/home/tkloczko/rpmbuild/BUILD/zope.i18nmessageid-5.0.1/docs/hacking.rst:150: WARNING: py:mod reference target not found: zc.buildout
/home/tkloczko/rpmbuild/BUILD/zope.i18nmessageid-5.0.1/docs/hacking.rst:156: WARNING: py:mod reference target not found: zope.i18nmessageid
/home/tkloczko/rpmbuild/BUILD/zope.i18nmessageid-5.0.1/docs/hacking.rst:186: WARNING: py:mod reference target not found: tox
/home/tkloczko/rpmbuild/BUILD/zope.i18nmessageid-5.0.1/docs/hacking.rst:199: WARNING: py:mod reference target not found: zope.i18nmessageid
/home/tkloczko/rpmbuild/BUILD/zope.i18nmessageid-5.0.1/docs/hacking.rst:199: WARNING: py:mod reference target not found: tox
/home/tkloczko/rpmbuild/BUILD/zope.i18nmessageid-5.0.1/docs/hacking.rst:202: WARNING: py:mod reference target not found: zope.i18nmessageid
/home/tkloczko/rpmbuild/BUILD/zope.i18nmessageid-5.0.1/docs/hacking.rst:207: WARNING: py:mod reference target not found: zope.i18nmessageid
/home/tkloczko/rpmbuild/BUILD/zope.i18nmessageid-5.0.1/docs/hacking.rst:207: WARNING: py:mod reference target not found: nose
/home/tkloczko/rpmbuild/BUILD/zope.i18nmessageid-5.0.1/docs/hacking.rst:207: WARNING: py:mod reference target not found: coverage
/home/tkloczko/rpmbuild/BUILD/zope.i18nmessageid-5.0.1/docs/hacking.rst:212: WARNING: py:mod reference target not found: zope.i18nmessageid
/home/tkloczko/rpmbuild/BUILD/zope.i18nmessageid-5.0.1/docs/hacking.rst:262: WARNING: py:mod reference target not found: zope.i18nmessageid
/home/tkloczko/rpmbuild/BUILD/zope.i18nmessageid-5.0.1/docs/hacking.rst:268: WARNING: py:mod reference target not found: zope.i18nmessageid
done
build succeeded, 26 warnings.

You can peak on fixes that kind of issues in other projects
latchset/jwcrypto#289
click-contrib/sphinx-click@abc31069

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.