Skip to content

Instantly share code, notes, and snippets.

View flodolo's full-sized avatar

Francesco Lodolo flodolo

View GitHub Profile
@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
(last update: 2022-08-26)
ClearGroupedTabsCancel (v100)
ClearGroupedTabsDelete (v100)
ClearGroupedTabsTitle (v100)
SearchBarPlacementForExistingUsers (v98)
Tools (v96)
Window (v96)
@flodolo
flodolo / marketing_locales.py
Last active August 18, 2022 14:36
Extract shipping locales for Firefox/Focus mobile and VPN
#! /usr/bin/env python3
"""
Check if Pontoon locales are missing in the repository for iOS projects.
"""
import argparse
import json
import sys
from urllib.parse import quote as urlquote