Mastodon

Local DB

What is it?

A Command Line tool to aid with software localization; specifically organization and translation. Subscribe to the mailing list to to be notified on future updates.

Why is it special?

It is all about the database! This tool builds, modifies, and exports from a SQLite database, which is just a file. Store it in your source control and query this DB from your other systems. Include this tool in your pipelines, automate away!

How much does it cost?

$5 with free updates forever. It is a single binary, store it, copy it, do whatever you want with it.

Targets

Local DB is a single binary with SQLite statically linked. We cross-compile on linux to 3 other targets. MacOS binaries are unsigned.

We provide binaries for the following targets:

  • linux-x86_64
  • macos-aarch64
  • macos-x86_64
  • windows-x86_64

Features

Documentation for version: 1.0

Report bugs/feature requests here

Examples

Below are the three things you can do with this tool: import, translate, and export.

Import to DB

Import from two formats: json and csv. Json and csv formats are specific to this tool but are quite simple to implement. Here is what the json format looks like:

[ {"key": "difficulty_easy", "data": "Easy", "language": "en"}, {"key": "difficulty_easy", "data": "簡単", "language": "ja"}, {"key": "difficulty_hard", "data": "Hard", "language": "en"}, {"key": "difficulty_hard", "data": "難しい", "language": "ja"} ]


CSV format:
key,data,language difficulty_easy,Easy,en difficulty_easy,簡単,ja difficulty_hard,Hard,en difficulty_hard,難しい,ja

Commands to import all translations from these files to the database 'mydb'. Format is derived from filetype suffix, no need to pass an extra parameter.
lli_localdb import --file=locales.json --db=mydb lli_localdb import --file=locales.csv --db=mydb

Translate in DB

Translate existing entries in the DB to other languages. Always best to use human translators if you can afford it, but this tool will get you started. Current translation providers: Google Translate and LibreTranslate. If you have a favorite API-Based Translation provider that is missing please let us know!
lli_localdb translate --source-lang=en --to=fr --provider=libretranslate --endpoint=http://localhost:5000 lli_localdb translate --source-lang=en --to=ja,es --provider=google-translate --env-file=.env lli_localdb translate --source-lang=en --to=ja,es --provider=google-translate --api-key=123456

Export from DB

Export to json and csv formats. Export formats are the same as the import formats.
lli_localdb export --db=mydb --file=export.csv lli_localdb export --db=mydb --file=translations.json lli_localdb export --db=mydb --file=locales.csv --lang=en,es,fr

Import/Export Formats

  • JSON (1.0)
  • [ {"key": "difficulty_easy", "data": "Easy", "language": "en"}, {"key": "difficulty_easy", "data": "簡単", "language": "ja"}, {"key": "difficulty_hard", "data": "Hard", "language": "en"}, {"key": "difficulty_hard", "data": "難しい", "language": "ja"} ]

  • CSV (1.0)
  • key,data,language difficulty_easy,Easy,en difficulty_easy,簡単,ja difficulty_hard,Hard,en difficulty_hard,難しい,ja

  • Have a preferred format? Let us know!

Translation Providers

  • LibreTranslate - Free and Open Source Machine Translation
  • Google Translate - Cloud API Machine Translation. You must provide your own api key.
  • Have a preferred provider? Let us know!

DB Schema

This tool has basic db inspection with the db command. But if you have specific questions about your data probably best to run your own queries.

Here is the db schema if you wish to query the data directly. There is one table:

CREATE TABLE IF NOT EXISTS translations ( id INTEGER PRIMARY KEY AUTOINCREMENT, key TEXT NOT NULL, language TEXT NOT NULL, value TEXT NOT NULL, UNIQUE(key, language) );

You can always ask for help

Hopefully this is enough to get you started. If not you can use `lli_localdb help` and `lli_localdb help import|translate|export|db` for information about a specific command. If you have any questions, feedback, or bugs please let us know. See contact links at the top of this page.