Skip to content

Instantly share code, notes, and snippets.

@fweez
fweez / Localization key value merging.md
Last active March 20, 2020 20:28 — forked from buddhisthead/Localization key value merging.md
String Localization Merging process

This sort of documents the hopefully one-time process of merging some keys and values for localized strings

There are four things:

  1. a source of truth key/value file from Android (./RWApp/Base.lproj/Localizable.strings) called Master below.
  2. the existing English "base" localization file (./RWApp/en.lproj/Localizable.strings)
  3. non-localized Swift strings (extracted with genstrings)
  4. non-localized ObjC strings (extracted with genstrings)

The source of truth file is generated from a different series of tools documented here: https://github.com/ridewithgps/RWGPS-app-common/blob/develop/translation/README.md

# Copyright Jehiah Czebotar 2013
# http://jehiah.cz/
# Modifications by Ryan Forsythe 2013:
# * Switch to stdlib's optparse rather than relying on tornado's option parsing
# * Add new-style backup database parsing.
# NOTE: This is broken for SMS phone numbers. Currently researching a fix.
import optparse
@fweez
fweez / roschambo.py
Created August 20, 2011 17:18
Roschambo multiperson game simulator
#!/usr/bin/env python
import random
PLAYER_COUNT = 5
players = [ None ] * PLAYER_COUNT
ROCK = 1
PAPER = 2
SCISSORS = 3
@fweez
fweez / ben.py
Created June 27, 2011 18:26
A Benford's law bucketizer on file sizes in a directory
#!/usr/bin/env python
import os
import subprocess
# First, build up the results file. it'll have the form:
# 110 vidioc-g-dv-preset.xml
linecount_cmd = "rm results; for i in *; do find $i -execdir wc -c '{}' \; " + \
">> results; done;"
os.system(linecount_cmd)