Skip to content

Instantly share code, notes, and snippets.

View flodolo's full-sized avatar

Francesco Lodolo flodolo

View GitHub Profile
@flodolo
flodolo / convert.sh
Last active January 28, 2024 08:13
Convert l10n repos to monorepo
#! /usr/bin/env bash
# This script requires git-cinnabar and jq installed
# https://github.com/glandium/git-cinnabar
# https://jqlang.github.io/jq/download/
#
# If you pass a path to the script, it will search for locale clones in that folder.
# If that's not available, it will clone the remote repository for the locale.
clones_path=$1
@flodolo
flodolo / verify_windowsbg_experiment.py
Last active May 22, 2023 13:48
Verify Windows Background Notifications experiment
import json
import sys
from urllib.request import urlopen
# Get translations
translations_url = "https://raw.githubusercontent.com/mozilla-l10n/nimbus-l10n/main/.github/storage/windows_bg_notifications_2023.json"
try:
r = urlopen(translations_url)
translations = json.load(r)["translations"]
except Exception as e:
@flodolo
flodolo / podcasts.md
Last active April 18, 2023 06:06
List of podcasts

Podcasts marked as (new) are still in review, and might be removed if they don't deliver.

Entertainment

  • SmartLess - Jason Bateman, Sean Hayes, Will Arnett
  • Conan O’Brien Needs A Friend - Team Coco & Earwolf
  • (new) The Problem With Jon Stewart

Localization

@flodolo
flodolo / focus.py
Last active February 28, 2023 17:12
Focus locales missing from Fenix
#! /usr/bin/env python3
import json
from urllib.parse import quote as urlquote
from urllib.request import urlopen
def main():
query = """
{
@flodolo
flodolo / gist:ee76904421ad7a820a65b690e27e2542
Created December 20, 2022 19:59
Analyze Fenix data with CSV
#!/usr/bin/env python3
"""
This script is used to check top locales for Fenix in specific countries,
and try to find a best match in Pontoon locales.
It expects a CSV file stored as "android_data.csv" from this query
https://sql.telemetry.mozilla.org/queries/89302
"""
#!/usr/bin/env python
"""
This script uses https://hg.mozilla.org/projects/comm-l10n/ repository to
create repositories with source strings only for Thunderbird and Seamonkey.
"""
import datetime
import os
import shutil
import subprocess
@flodolo
flodolo / import_translation_bar.py
Created October 19, 2022 12:18
Import translations for Firefox Translations notification bar
#! /usr/bin/env python3
import argparse
from copy import deepcopy
import json
import os
from urllib.request import urlopen
def main():
parser = argparse.ArgumentParser()
@flodolo
flodolo / messages.json
Created October 19, 2022 10:02
Translations without DTDs
{
"extensionName": {
"message": "Firefox Translations",
"description": "Name of the extension. Do NOT translate, keep the name in English."
},
"extensionDescription": {
"message": "Translate websites in your browser without using the cloud.",
"description": "Description of the extension."
},
"loadingTranslationEngine": {
@flodolo
flodolo / extract_translations.py
Created September 23, 2022 07:49
Extract and inject iOS translations
#! /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/.
"""
Extract translations for a specific string ID in XLIFF file, and store them in
a local JSON file.
"""
@flodolo
flodolo / get_region_names.py
Last active January 2, 2023 14:14
Get Mozilla region names as JSON
#! /usr/bin/env python
# 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/.
from urllib.request import urlopen
import argparse
import json
import os