Skip to content

Instantly share code, notes, and snippets.

View flodolo's full-sized avatar

Francesco Lodolo flodolo

View GitHub Profile
@flodolo
flodolo / fix_doh_labels.py
Created March 11, 2026 05:22
Fix DOH labels in fx150
#!/usr/bin/env python3
"""
Remove trailing punctuation from specific Fluent message attributes in
browser/browser/preferences/preferences.ftl across all locales.
- preferences-doh-radio-default/custom/off: fix .description
- preferences-doh-fallback-label: fix .label
"""
import os
@flodolo
flodolo / time_to_translation.py
Last active March 10, 2026 07:38
Pontoon: time to translate/review
from pontoon.base.models import Project, Locale, Entity, Translation
from django.db.models import F
from datetime import datetime, timezone
project_slug = "firefox"
# Top 15 desktop locales based on DAU, excluding en-*
locale_codes = ["de", "fr", "es-ES", "ru", "pl", "pt-BR", "it", "zh-CN", "ja", "es-MX", "nl", "id", "cs", "hu", "es-AR"]
start_date = datetime(2026, 1, 1, tzinfo=timezone.utc)
end_date = datetime(2026, 12, 31, 23, 59, 59, tzinfo=timezone.utc)
@flodolo
flodolo / completion.py
Created February 11, 2026 13:23
Firefox Onboarding Refresh completion status (v148)
#!/usr/bin/env python3
"""
Pontoon translation coverage report for a given search query.
- Queries Pontoon search/translations endpoint (custom User-Agent).
- Extracts entity IDs.
- Fetches translations for each entity.
- Computes per-locale completion across the entity set.
Requires: requests
@flodolo
flodolo / gist:7eaa9369dca047398ebf28a95af088f8
Created January 27, 2026 07:41
Git diff for bug 2010181
diff --git a/browser/components/preferences/moreFromMozilla.js b/browser/components/preferences/moreFromMozilla.js
index 109d334ea334..d426bebcc1bf 100644
--- a/browser/components/preferences/moreFromMozilla.js
+++ b/browser/components/preferences/moreFromMozilla.js
@@ -170,7 +170,7 @@ var gMoreFromMozillaPane = {
products.push({
id: "mdn",
- title_string_id: "more-from-moz-mdn-title",
+ title_string_id: "more-from-moz-mdn-title2",
@flodolo
flodolo / test.ftl
Created November 12, 2025 06:07
Test FTL file with variants
-brand-account =
{ $capitalization ->
[uppercase] Mozilla Account
*[lowercase] Mozilla account
}
test-message-lowercase = Your { -brand-account }
test-message-uppercase = Your { -brand-account(capitalization: "uppercase") }
@flodolo
flodolo / remove_obsolete_files.py
Created October 16, 2025 05:50
Remove thunderbird-l10n obsolete files
#!/usr/bin/env python3
import os
def extractFileList(repository_path):
"""
Extract the list of supported files. Store the relative path and ignore
specific paths.
"""
@flodolo
flodolo / strings.xml
Created September 25, 2025 14:34
Test android parsing
<!DOCTYPE resources>
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<string name="single_quote">They\'re great</string>
<string name="double_quotes">They are \"great\"</string>
<string name="both_quotes">They\'re really \"great\"</string>
</resources>
@flodolo
flodolo / relay_obsolete_strings.py
Last active June 25, 2025 06:50
Identify obsolete strings in Relay
#!/usr/bin/env python3
import argparse
import os
import signal
import subprocess
import sys
from compare_locales import parser
# Capture CTRL+C
unreferenced_entities = []
@flodolo
flodolo / fxios_locale_completion_tree.py
Last active May 13, 2025 08:01
Firefox iOS completetion stats based on .strings files
#!/usr/bin/env python3
"""
Script to determine localization completion based on .strings files.
"""
import re
import sys
from pathlib import Path
@flodolo
flodolo / unused_strings_fxios.py
Created May 12, 2025 09:19
Identify strings in en-US .strings files but not available in Strings.swift
#!/usr/bin/env python3
"""
Script to find unused localized string IDs in .strings files under en-US.lproj
folders by checking their definitions in firefox-ios/Shared/Strings.swift.
"""
import re
import sys
from pathlib import Path