Skip to content

A Swift command-line tool to parse and traverse AppleGlot Localization Glossaries

License

Notifications You must be signed in to change notification settings

julianschiavo/LocoBuddy

Repository files navigation

🗣 LocoBuddy

LocoBuddy is a Swift command-line tool that makes it easier to use and search Apple's AppleGlot translation glossaries, which are exports of translations used in Apple's system apps, such as Maps and Home, for all system languages.

However, these translation glossaries are provided in lg file formats, and separated per each system app. LocoBuddy handles parsing these glossaries to search for specific terms and translate a found term into any number of given languages.

This package is heavily inspired by and uses code adapted from Douglas' in depth blog post on parsing these glossaries.


Requirements

LocoBuddy requires macOS 11+ and is used directly on the command-line (Terminal). The command-line interface is created through Apple's Swift Argument Parser library, which is added through Swift Package Manager.

SF Symbols are used in output, so it is recommended to use an Apple SF font, such as SF Mono, on Terminal, but if not the tool will work and display unicode unknown symbols instead.


Installation

You can download the latest build of LocoBuddy, or build it from the source in this repository.

Prebuilt Install

Download the LocoBuddy binary in the latest release, then run it from Terminal.

Manual Build

Clone this repository, then run swift build in the source folder using Terminal, and find the binary in the .build/debug or .build/release folder.


Usage

This tool requires Apple's translation glossaries to be downloaded and mounted; a valid Apple Developer account is required to download the glossaries. Download the glossary languages you want from Apple's website by searching for glossaries, then mount the dmg disk images by double-clicking on each one.

After mounting the disk images, search for terms in the glossaries you downloaded. For example, to search for "Book" in the Simplified Chinese glossary:

LocoBuddy search --language "Simplified Chinese" --match contains "Book"
􀅴   Found 12 strings matching or containing `Cancel Ride`!

􀅶   Add to Bookmarks
􀰑   加入書籤
􀟕   URL_ACTION_BOOKMARK
􀎫   ContactsUI.lg
...

You can then translate a specific key (e.g. URL_ACTION_BOOKMARK) into one or more languages, using the initials or full names of the glossaries, at the same time:

(SC is Simplified Chinese, TC is Traditional Chinese)

LocoBuddy translate --key "URL_ACTION_BOOKMARK" "SC" "TC" 
􀰑   加入書籤
􀎫   ContactsUI.lg
􀆪   Traditional Chinese

􀰑   添加到书签
􀎫   ContactsUI.lg
􀆪   Simplified Chinese
...

Contributing

Contributions and pull requests are welcomed by anyone! If you find an issue with LocoBuddy, file a Github Issue, or, if you know how to fix it, submit a pull request.

Please review our Code of Conduct and Contribution Guidelines before making a contribution.


Credit

LocoBuddy was created by Julian Schiavo, and published under the MIT License. The original code is adapted from Douglas Hill's post Localisation using Apple’s glossaries under the MIT License.


License

Available under the MIT License. See the License for more info.

About

A Swift command-line tool to parse and traverse AppleGlot Localization Glossaries

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages