This package provides an extension to the File and Image content components for Zope 3, allowing the content to be localized.
Detailed Dcoumentation
I18nFile tests
First, let’s create an I18nFile instance:
>>> print http(r"""
... POST /@@contents.html HTTP/1.1
... Authorization: Basic mgr:mgrpw
... """, form={"type_name": "BrowserAdd__zope.app.i18nfile.i18nfile.I18nFile",
... "new_value": "i18nfile"})
HTTP/1.1 303 See Other
...
Then add some sample data for default (en) language:
>>> print http(r"""
... POST /i18nfile/edit.html HTTP/1.1
... Authorization: Basic mgr:mgrpw
... """, form={"contentType": "text/plain",
... "defaultLanguage": "en",
... "language": "en",
... "newLanguage": "",
... "data": "English",
... "edit": "Save"})
HTTP/1.1 303 See Other
...
Ok, now we can view the data in the edit form:
>>> print http(r"""
... GET /i18nfile/editForm.html?language=en HTTP/1.1
... Authorization: Basic mgr:mgrpw
... """)
HTTP/1.1 200 OK
...
<textarea ...>English</textarea>
...
and as file content:
>>> print http(r""" ... GET /i18nfile/index.html HTTP/1.1 ... Authorization: Basic mgr:mgrpw ... """) HTTP/1.1 200 OK ... English
Let’s add new (russian) language:
>>> print http(r"""
... POST /i18nfile/edit.html HTTP/1.1
... Authorization: Basic mgr:mgrpw
... """, form={"contentType": "text/plain",
... "defaultLanguage": "en",
... "language": "en",
... "addLanguage": "Add new language",
... "newLanguage": "ru",
... "data": "English"})
HTTP/1.1 303 See Other
...
and add some sample data for russian (ru) language:
>>> print http(r"""
... POST /i18nfile/edit.html HTTP/1.1
... Authorization: Basic mgr:mgrpw
... """, form={"contentType": "text/plain",
... "defaultLanguage": "en",
... "language": "ru",
... "newLanguage": "",
... "data": "Russian",
... "edit": "Save"})
HTTP/1.1 303 See Other
...
Then we can view sample data for russain language in the edit form:
>>> print http(r"""
... GET /i18nfile/editForm.html?language=ru HTTP/1.1
... Authorization: Basic mgr:mgrpw
... """)
HTTP/1.1 200 OK
...
<textarea ...>Russian</textarea>
...
and if our preferred language is russian as file content:
>>> print http(r""" ... GET /i18nfile/index.html HTTP/1.1 ... Authorization: Basic mgr:mgrpw ... Accept-Language: ru,en ... """) HTTP/1.1 200 OK ... Russian
I18nImage tests
First, let’s create an I18nImage instance:
>>> print http(r"""
... POST /@@contents.html HTTP/1.1
... Authorization: Basic mgr:mgrpw
... """, form={
... "type_name": "BrowserAdd__zope.app.i18nfile.i18nimage.I18nImage",
... "new_value": "i18nimage"})
HTTP/1.1 303 See Other
...
Then add some sample image data for default (en) language:
>>> print http(r"""
... POST /i18nimage/uploadAction.html HTTP/1.1
... Authorization: Basic mgr:mgrpw
... """, form={"contentType": "image/gif",
... "defaultLanguage": "en",
... "language": "en",
... "newLanguage": "",
... "data": 'GIF89aENEN',
... "edit": "Save"})
HTTP/1.1 303 See Other
...
Ok, now we can view the image size in the edit form:
>>> print http(r""" ... GET /i18nimage/upload.html?language=en HTTP/1.1 ... Authorization: Basic mgr:mgrpw ... """) HTTP/1.1 200 OK ... ...>1 KB 20037x20037</... ...
and the image data as file content:
>>> print http(r""" ... GET /i18nimage/ HTTP/1.1 ... Authorization: Basic mgr:mgrpw ... """) HTTP/1.1 200 OK Content-Length: 10 Content-Type: image/gif <BLANKLINE> GIF89aENEN
Let’s add new (russian) language:
>>> print http(r"""
... POST /i18nimage/uploadAction.html HTTP/1.1
... Authorization: Basic mgr:mgrpw
... """, form={"contentType": "image/gif",
... "defaultLanguage": "en",
... "language": "en",
... "addLanguage": "Add new language",
... "newLanguage": "ru",
... "data": ""})
HTTP/1.1 303 See Other
...
and add some sample image data for russian (ru) language:
>>> print http(r"""
... POST /i18nimage/uploadAction.html HTTP/1.1
... Authorization: Basic mgr:mgrpw
... """, form={"contentType": "image/gif",
... "defaultLanguage": "en",
... "language": "ru",
... "newLanguage": "",
... "data": "GIF89aRURU",
... "edit": "Save"})
HTTP/1.1 303 See Other
...
Then we can view the size of sample image for russain language in the edit form:
>>> print http(r""" ... GET /i18nimage/upload.html?language=ru HTTP/1.1 ... Authorization: Basic mgr:mgrpw ... """) HTTP/1.1 200 OK ... ...>1 KB 21842x21842</... ...
and if our preferred language is russian we can view the image as file content:
>>> print http(r""" ... GET /i18nimage/ HTTP/1.1 ... Authorization: Basic mgr:mgrpw ... Accept-Language: ru,en ... """) HTTP/1.1 200 OK Content-Length: 10 Content-Type: image/gif <BLANKLINE> GIF89aRURU
CHANGES
3.4.1 (2007-10-31)
Resolve ZopeSecurityPolicy deprecation warning.
3.4.0 (2007-10-24)
Initial release independent of the main Zope tree.
Metadata
Release files for zope.app.i18nfile 3.4.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| zope.app.i18nfile-3.4.1.tar.gz | 11.4 kB | Without provenance | Details |
Release files / zope.app.i18nfile-3.4.1.tar.gz
| Download URL | zope.app.i18nfile-3.4.1.tar.gz |
|---|---|
| Size | 11.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
92b29c423f479614f149002c0b2aa19ea586242f9d0603175ef37d50dc363ea9
|
|
BLAKE2b-256 checksum How to use checksums |
dcf62b8aa1bf333fd3823d112a91c1f55e956342baa9d6e6b05650e8f2d44e81
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for zope.app.i18nfile 3.4.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.