Skip to content

Instantly share code, notes, and snippets.

View threethan's full-sized avatar

Ethan Medeiros threethan

View GitHub Profile
@threethan
threethan / translate_android_string.py
Last active October 25, 2025 06:47
Translate Android strings.xml with DeepL and python. Supports incremental translation & mid-string tags.
'''
Translate Android strings.xml files using DeepL API.
Requires an API key from https://www.deepl.com/pro-api
Usage:
- Set the DEEPL_API_KEY environment variable to your key or pass it via --auth-key
- Run the script with --res-dir pointing to your Android res folder (or without args to see help)
- Optionally specify source and target languages, and files to translate.
(Default: Extend existing translations in values folders from EN strings.xml)
'''
@threethan
threethan / DataStoreEditor.java
Last active October 21, 2025 06:02
An easy to use Java-only wrapper for Android DataStores which can be used to migrate from SharedPreferences
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Build;
import android.preference.PreferenceManager;
import android.util.Log;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;