This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

What is this?

It’s a package of Python code for manipulating Mac OS X/iOS .strings files, which has been written carefully to support all of the character escapes and Unicode characters you might wish to use.

How do I use it?

To read a .strings file:

>>> from nslocalized import StringTable
>>> st = StringTable.read('/path/to/my/Localized.strings')

or to read the strings into an existing StringTable:

>>> st.read('/path/to/my/other/Localized.strings')

To write a new .strings file:

>>> st.write('/path/to/my/new/Localized.strings')

By default, that uses host-endian UTF-16, but you can specify the encoding:

>>> st.write('/path/to/my/new/Localized.strings', encoding='utf_8')

Each string is represented by a LocalizedString object; given the strings file:

/* My important string */
"Very important" = "Très important";

in a StringTable st:

>>> ls = st.lookup('Very important')
>>> print ls.source
Very important
>>> print ls.target
Très important
>>> print ls.comment
My important string

You can also add entries to a StringTable with:

>>> st.store(LocalizedString('One', 'Uno'))

or with a comment:

>>> st.store(LocalizedString('MB', 'Mo', 'Megabytes'))

Finally, for simple access you can use the [] operator:

>>> st['GB'] = 'Go'
>>> print st['MB']
Mo

In some cases you might want to load the string table without processing escapes. In that case, you can do:

>>> st = StringTable.read('/path/to/my/Localized.strings',
process_escapes=False)

which will read the table without any escape processing taking place. Obviously if you read a table in this form, you will also want to write it without escaping:

>>> st.write('/path/to/my/new/Localized.strings', escape_strings=False)
Release History

Release History

0.2.0

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1.0

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
nslocalized-0.2.0.tar.gz (6.1 kB) Copy SHA256 Checksum SHA256 Source Jan 11, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting