https://github.com/michaelrsweet/stringsutil
Simple localization library and tool for Apple ".strings" files
https://github.com/michaelrsweet/stringsutil
c localization strings
Last synced: 30 days ago
JSON representation
Simple localization library and tool for Apple ".strings" files
- Host: GitHub
- URL: https://github.com/michaelrsweet/stringsutil
- Owner: michaelrsweet
- License: apache-2.0
- Created: 2022-04-13T12:06:54.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2025-12-19T20:08:22.000Z (6 months ago)
- Last Synced: 2025-12-26T21:52:59.359Z (6 months ago)
- Topics: c, localization, strings
- Language: C
- Homepage: https://www.msweet.org/stringsutil
- Size: 311 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGES.md
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Security: SECURITY.md
- Notice: NOTICE
Awesome Lists containing this project
README
StringsUtil - Strings File Library and Utility
==============================================




StringsUtil provides a library for using Apple ".strings" localization files and
a utility for managing those files. It is intended as a free, smaller,
embeddable, and more flexible alternative to GNU gettext. Key features include:
- Support for localizing using both Apple ".strings" and GNU gettext ".po"
files.
- Simple C/C++ library with support for embedding localization data in an
executable and/or loading localizations from external files.
- Tools for exporting, importing, and merging localization files.
- Tool for reporting on the quality of a localization.
- Tool for scanning C/C++ source files for localization strings.
- Tool for doing a first pass machine translation using the LibreTranslate
service/software.
Requirements
------------
You'll need a C compiler and the CUPS library.
"Kicking the Tires"
-------------------
StringsUtil provides a configure script that creates a makefile which allows
you to build the unit tests on Linux and macOS (at least), which verify that all
of the functions work as expected:
./configure
make test
The makefile also builds the `stringsutil` program.
Installing
----------
Run:
sudo make install
to install it in `/usr/local` along with a man page.
Using the `stringsutil` Tool
----------------------------
The `stringsutil` tool allows you to manage your ".strings" files. Create a
".strings" file by scanning source files in the current directory with the
"scan" sub-command:
stringsutil -f base.strings scan *.[ch]
Create a ".po" file for external localizers to work with using the "export"
sub-command:
stringsutil -f base.strings export es.po
When the localizer is done, use the "import" sub-command to import the strings
from the ".po" file:
cp base.strings es.strings
stringsutil -f es.strings import es.po
Run the "report" sub-command to see how well the localizer did:
stringsutil -f base.strings report es.strings
When you have made source changes that affect the localization strings, use the
"scan" sub-command again to update the base strings:
stringsutil -f base.strings scan *.[ch]
Then add those changes to the "es.strings" file with the "merge" sub-command:
stringsutil -f es.strings -c merge base.strings
The "translate" sub-command uses a LibreTranslate service to do a first-pass
machine translation of your strings. For example, the following command will
use a local Docker instance of LibreTranslate:
stringsutil -f es.strings -l es -T http://localhost:5000 translate base.strings
You also use the "export" command to produce a C header file containing a
strings file that can be embedded in a program:
stringsutil -f es.strings export es_strings.h
Legal Stuff
-----------
Copyright © 2022-2025 by Michael R Sweet.
StringsUtil is licensed under the Apache License Version 2.0 with an (optional)
exception to allow linking against GPL2/LGPL2-only software. See the files
"LICENSE" and "NOTICE" for more information.