brunogama / localizablestrings

Localizable.strings reader and writer for Python

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Localizablestrings

A simple reader and writer for Localizable.strings files as used by Xcode projects.

Installation

pip install localizablestrings

Usage

from localizablestrings import StringsFile, Translation

sf = StringsFile('/path/to/Localizable.strings')

for translation in sf:
    print(f'Key = {translation.key}\nValue = {translation.value}\nComment = {translation.comment}')

if sf.get_translation('spam') is None:
    new_translation = Translation(key='spam', value='eggs', comment='Needs more bacon')
    sf.add_translation(new_translation)

sf.write()

About

Localizable.strings reader and writer for Python

License:BSD 2-Clause "Simplified" License


Languages

Language:Python 100.0%