INNER CODE UNIT · Python

locale_in_sync

emanuele-f/PCAPdroid · tools/weblate.py:112

def locale_in_sync(locale):
    """True if the locale file is identical on weblate/master and HEAD."""
    path = locale_path(locale)
    return git("diff", "--quiet", f"{REMOTE}/master", "HEAD", "--", path,
               check=False).returncode == 0

def working_tree_clean():
    return git("diff", "--quiet", "--", STRINGS_BASE, check=False).returncode == 0 and \
           git("diff", "--cached", "--quiet", "--", STRINGS_BASE, check=False).returncode == 0

def get_supported_locales():
    """Non-English locales from resourceConfigurations in build.gradle."""
    with open(BUILD_GRADLE) as f:
        content = f.read()
    locales = re.findall(r'"([a-z]{2}(?:-r[A-Z]{2})?)"',
                         content.split("resourceConfigurations")[1].split("]")[0])
    locales = [l for l in locales if l != "en"]
    return sorted(locales)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…