Skip to content

Instantly share code, notes, and snippets.

@flodolo
Last active August 26, 2022 05:10
Show Gist options
  • Save flodolo/b859884d7f700de678839e1c50a96773 to your computer and use it in GitHub Desktop.
Save flodolo/b859884d7f700de678839e1c50a96773 to your computer and use it in GitHub Desktop.
#! /usr/bin/env bash
# Extract strings
fx_repo="/Users/flodolo/github/firefox-ios"
python ./extract_ids_strings.py "${fx_repo}/Client/Frontend/Strings.swift"
input="./string_ids.txt"
while IFS= read -r line
do
# take action on $line #
parts=(${line})
id="${parts[0]}"
last_update="${parts[1]}"
grep -qr "${fx_repo}" --include=\*.swift --exclude=Strings.swift -e "\.${id}" && : || echo "${id} ${last_update}"
done < "$input"
#! /usr/bin/env python3
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import argparse
import os
import sys
def main():
parser = argparse.ArgumentParser()
parser.add_argument(
"path",
help="Path to Client/Frontend/Strings.swift",
)
args = parser.parse_args()
ids = []
with open(args.path) as f:
lines = f.readlines()
for index, line in enumerate(lines):
line = line.strip()
# Example: public static let ProtectionStatusSecure = MZLocalizedString(
if "= MZLocalizedString(" in line:
id = line[: -len(" = MZLocalizedString(")].split(" ")[-1]
for i in range(3, 6):
if "lastUpdated" in lines[index + i]:
last_update = (
lines[index + i].strip().split(".")[-1].rstrip(")")
)
ids.append(f"{id} ({last_update})")
ids.sort()
with open("string_ids.txt", "w") as f:
f.write("\n".join(ids))
if __name__ == "__main__":
main()
(last update: 2022-08-26)
ClearGroupedTabsCancel (v100)
ClearGroupedTabsDelete (v100)
ClearGroupedTabsTitle (v100)
SearchBarPlacementForExistingUsers (v98)
Tools (v96)
Window (v96)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment