[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [Git][tpo/applications/tor-browser][tor-browser-147.0a1-16.0-2] fixup! BB 42305: Add script to combine translation files across versions.



Title: GitLab

henry pushed to branch tor-browser-147.0a1-16.0-2 at The Tor Project / Applications / Tor Browser

Commits:

  • 0f10cc1e
    by Henry Wilkes at 2026-01-15T13:43:12+00:00
    fixup! BB 42305: Add script to combine translation files across versions.
    
    TB 44498: Change the expected browser version gap between stable and
    alpha from 0.5 to 1.0.
    

1 changed file:

Changes:

  • tools/base_browser/l10n/combine-translation-versions.py
    ... ... @@ -103,10 +103,11 @@ class BrowserBranch:
    103 103
     
    
    104 104
             self.name = branch_name
    
    105 105
             self.prefix = version_match.group("prefix")
    
    106
    -        self.browser_version = version_match.group("browser")
    
    106
    +        browser_version_str = version_match.group("browser")
    
    107
    +        self.browser_version = float(browser_version_str)
    
    107 108
             # Convert tor-browser to "Tor Browser", and similar.
    
    108 109
             browser_name = self.prefix.replace("-", " ").title()
    
    109
    -        self.browser_version_name = f"{browser_name} {self.browser_version}"
    
    110
    +        self.browser_version_name = f"{browser_name} {browser_version_str}"
    
    110 111
     
    
    111 112
             self._is_head = is_head
    
    112 113
             self._ref = "HEAD" if is_head else f"origin/{branch_name}"
    
    ... ... @@ -114,7 +115,7 @@ class BrowserBranch:
    114 115
             firefox_nums = [int(n) for n in version_match.group("firefox").split(".")]
    
    115 116
             if len(firefox_nums) == 2:
    
    116 117
                 firefox_nums.append(0)
    
    117
    -        browser_nums = [int(n) for n in self.browser_version.split(".")]
    
    118
    +        browser_nums = [int(n) for n in browser_version_str.split(".")]
    
    118 119
             branch_number = int(version_match.group("number"))
    
    119 120
             # Prioritise the firefox ESR version, then the browser version then the
    
    120 121
             # branch number.
    
    ... ... @@ -127,25 +128,8 @@ class BrowserBranch:
    127 128
                 branch_number,
    
    128 129
             )
    
    129 130
     
    
    130
    -        # Minor version for browser is only ever "0" or "5", so we can convert
    
    131
    -        # the version to an integer.
    
    132
    -        self._browser_int_version = int(2 * float(self.browser_version))
    
    133
    -
    
    134 131
             self._file_paths: list[str] | None = None
    
    135 132
     
    
    136
    -    def release_below(self, other: "BrowserBranch", num: int) -> bool:
    
    137
    -        """Determine whether another branch is within range of a previous
    
    138
    -        browser release.
    
    139
    -
    
    140
    -        The browser versions are expected to increment by "0.5", and a previous
    
    141
    -        release branch's version is expected to be `num * 0.5` behind the
    
    142
    -        current one.
    
    143
    -
    
    144
    -        :param other: The branch to compare.
    
    145
    -        :param num: The number of "0.5" releases behind to test with.
    
    146
    -        """
    
    147
    -        return other._browser_int_version == self._browser_int_version - num
    
    148
    -
    
    149 133
         def __lt__(self, other: "BrowserBranch") -> bool:
    
    150 134
             return self._ordered < other._ordered
    
    151 135
     
    
    ... ... @@ -259,16 +243,14 @@ def get_stable_branch(
    259 243
                 # Stable can be one release version behind.
    
    260 244
                 # NOTE: In principle, when switching between versions there may be a
    
    261 245
                 # window of time where the development branch has not yet progressed
    
    262
    -            # to the next "0.5" release, so has the same browser version as the
    
    246
    +            # to the next ".0" release, so has the same browser version as the
    
    263 247
                 # stable branch. So we also allow for matching browser versions.
    
    264 248
                 # NOTE:
    
    265 249
                 # 1. The "Will be unused in" message will not make sense, but we do
    
    266 250
                 #    not expect string differences in this scenario.
    
    267 251
                 # 2. We do not expect this scenario to last for long.
    
    268
    -            if not (
    
    269
    -                compare_version.release_below(branch, 1)
    
    270
    -                or compare_version.release_below(branch, 0)
    
    271
    -            ):
    
    252
    +            release_diff = compare_version.browser_version - branch.browser_version
    
    253
    +            if release_diff < 0.0 or release_diff > 1.0:
    
    272 254
                     continue
    
    273 255
                 stable_branches.append(branch)
    
    274 256
             elif is_legacy:
    

  • _______________________________________________
    tor-commits mailing list -- tor-commits@xxxxxxxxxxxxxxxxxxxx
    To unsubscribe send an email to tor-commits-leave@xxxxxxxxxxxxxxxxxxxx