Skip to content

Commit 11e7c83

Browse files
committed
Bug 1232241 - Move Firefox for iOS strings from SVN to GitHub
1 parent 7f952f3 commit 11e7c83

File tree

9 files changed

+48
-106
lines changed

9 files changed

+48
-106
lines changed

app/classes/Transvision/Project.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ public static function getLocaleInContext($locale, $context)
251251
$context = 'gaia';
252252
}
253253

254-
// Firefox for iOS: no mapping
254+
// Firefox for iOS
255255
$locale_mappings['firefox_ios'] = [
256256
'es-AR' => 'es',
257257
'es-ES' => 'es',

app/classes/Transvision/ShowResults.php

Lines changed: 10 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -288,19 +288,12 @@ public static function resultsTable($search_id, $search_results, $recherche, $lo
288288
$temp = explode('-', $locale2);
289289
$locale2_short_code = $temp[0];
290290

291-
switch ($current_repo) {
292-
case 'mozilla_org':
293-
$locale1_path = VersionControl::gitPath($locale1, $current_repo, $key);
294-
$locale2_path = VersionControl::gitPath($locale2, $current_repo, $key);
295-
break;
296-
case 'firefox_ios':
297-
$locale1_path = VersionControl::svnPath($locale1, $current_repo, $key);
298-
$locale2_path = VersionControl::svnPath($locale2, $current_repo, $key);
299-
break;
300-
default:
301-
$locale1_path = VersionControl::hgPath($locale1, $current_repo, $key);
302-
$locale2_path = VersionControl::hgPath($locale2, $current_repo, $key);
303-
break;
291+
if (in_array($current_repo, ['firefox_ios', 'mozilla_org'])) {
292+
$locale1_path = VersionControl::gitPath($locale1, $current_repo, $key);
293+
$locale2_path = VersionControl::gitPath($locale2, $current_repo, $key);
294+
} else {
295+
$locale1_path = VersionControl::hgPath($locale1, $current_repo, $key);
296+
$locale2_path = VersionControl::hgPath($locale2, $current_repo, $key);
304297
}
305298

306299
// errors
@@ -346,16 +339,10 @@ public static function resultsTable($search_id, $search_results, $recherche, $lo
346339

347340
// 3locales view
348341
if (isset($search_options["extra_locale"])) {
349-
switch ($current_repo) {
350-
case 'mozilla_org':
351-
$locale3_path = VersionControl::gitPath($locale3, $current_repo, $key);
352-
break;
353-
case 'firefox_ios':
354-
$locale3_path = VersionControl::svnPath($locale3, $current_repo, $key);
355-
break;
356-
default:
357-
$locale3_path = VersionControl::hgPath($locale3, $current_repo, $key);
358-
break;
342+
if (in_array($current_repo, ['firefox_ios', 'mozilla_org'])) {
343+
$locale3_path = VersionControl::gitPath($locale3, $current_repo, $key);
344+
} else {
345+
$locale3_path = VersionControl::hgPath($locale3, $current_repo, $key);
359346
}
360347

361348
$clipboard_target_string2 = 'clip_' . md5($target_string2);

app/classes/Transvision/VersionControl.php

Lines changed: 11 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ class VersionControl
1919
public static function getVCS($repo)
2020
{
2121
$vcs = [
22-
'git' => ['mozilla_org'],
22+
'git' => ['firefox_ios', 'mozilla_org'],
2323
'hg' => [],
24-
'svn' => ['firefox_ios'],
24+
'svn' => [],
2525
];
2626
$vcs['hg'] = array_merge(
2727
Project::getDesktopRepositories(),
@@ -187,26 +187,6 @@ public static function hgPath($locale, $repo, $path)
187187
return $url . $path . '/' . $entity_file;
188188
}
189189

190-
/**
191-
* Generate a path to the subversion repo for the file
192-
*
193-
* @param string $locale locale code
194-
* @param string $repo repository name
195-
* @param string $path Entity name representing the local file
196-
* @return string Path to the file in remote subversion repository
197-
*/
198-
public static function svnPath($locale, $repo, $path)
199-
{
200-
if ($repo == 'firefox_ios') {
201-
$file_path = "projects/l10n-misc/trunk/firefox-ios/{$locale}/firefox-ios.xliff";
202-
} else {
203-
$file_path = '';
204-
}
205-
206-
return 'https://viewvc.svn.mozilla.org/vc/'
207-
. $file_path . '?view=markup';
208-
}
209-
210190
/**
211191
* Generate a path to the GitHub repo for the file.
212192
* Only mozilla.org is supported for now.
@@ -219,15 +199,20 @@ public static function svnPath($locale, $repo, $path)
219199
public static function gitPath($locale, $repo, $path)
220200
{
221201
switch ($repo) {
202+
case 'firefox_ios':
203+
$repo = 'firefoxios-l10n';
204+
$file_path = 'firefox-ios.xliff';
205+
break;
222206
case 'mozilla_org':
223-
default:
224207
$repo = 'www.mozilla.org';
208+
$file_path = self::extractFilePath($path);
209+
break;
210+
default:
211+
$file_path = $path;
225212
break;
226213
}
227214

228-
return 'https://github.com/mozilla-l10n/'
229-
. $repo . '/blob/master/'
230-
. $locale . '/' . self::extractFilePath($path);
215+
return "https://github.com/mozilla-l10n/{$repo}/blob/master/{$locale}/$file_path";
231216
}
232217

233218
/**

app/scripts/bash_variables.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ mozilla_org=$local_git/mozilla_org/
4747
folders+=( $mozilla_org )
4848

4949
# Firefox for iOS (XLIFF)
50-
firefox_ios=$local_svn/firefox_ios/
50+
firefox_ios=$local_git/firefox_ios/
5151
folders+=( $firefox_ios )
5252

5353
# l20n test repo

app/scripts/glossaire.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -286,8 +286,8 @@ function updateFirefoxiOS() {
286286
if $checkrepo
287287
then
288288
cd $firefox_ios
289-
echogreen "Update subversion repository"
290-
svn up
289+
echogreen "Update GitHub repository"
290+
git pull
291291
fi
292292
if $createTMX
293293
then

app/scripts/setup.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -311,12 +311,12 @@ then
311311
git clone https://github.com/mozilla-l10n/www.mozilla.org .
312312
fi
313313

314-
echogreen "Firefox for iOS repo being checked out from subversion"
314+
echogreen "Firefox for iOS repo being checked out from GitHub"
315315
cd $firefox_ios
316-
if [ ! -d $firefox_ios/.svn ]
316+
if [ ! -d $firefox_ios/.git ]
317317
then
318318
echogreen "Checking out Firefox for iOS repo"
319-
svn co https://svn.mozilla.org/projects/l10n-misc/trunk/firefox-ios/ .
319+
git clone https://github.com/mozilla-l10n/firefoxios-l10n .
320320
fi
321321

322322
# We now deal with L20n test repo as a specific case

app/scripts/tmx_xliff

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ $project_name = $argv[1];
2626
$supported_projects = [
2727
'firefox_ios' => [
2828
'file_name' => 'firefox-ios.xliff',
29-
'base_path' => SVN . 'firefox_ios',
29+
'base_path' => GIT . 'firefox_ios',
3030
],
3131
];
3232

app/views/results_entities.php

Lines changed: 10 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,12 @@
1616
$current_repo = $check['repo'];
1717
// Display results
1818
foreach ($entities as $entity) {
19-
switch ($current_repo) {
20-
case 'mozilla_org':
21-
$path_locale1 = VersionControl::gitPath($source_locale, $current_repo, $entity);
22-
$path_locale2 = VersionControl::gitPath($locale, $current_repo, $entity);
23-
break;
24-
case 'firefox_ios':
25-
$path_locale1 = VersionControl::svnPath($source_locale, $current_repo, $entity);
26-
$path_locale2 = VersionControl::svnPath($locale, $current_repo, $entity);
27-
break;
28-
default:
29-
$path_locale1 = VersionControl::hgPath($source_locale, $current_repo, $entity);
30-
$path_locale2 = VersionControl::hgPath($locale, $current_repo, $entity);
31-
break;
19+
if (in_array($current_repo, ['firefox_ios', 'mozilla_org'])) {
20+
$path_locale1 = VersionControl::gitPath($source_locale, $current_repo, $entity);
21+
$path_locale2 = VersionControl::gitPath($locale, $current_repo, $entity);
22+
} else {
23+
$path_locale1 = VersionControl::hgPath($source_locale, $current_repo, $entity);
24+
$path_locale2 = VersionControl::hgPath($locale, $current_repo, $entity);
3225
}
3326

3427
// Escape strings for HTML display
@@ -48,16 +41,10 @@
4841
// Highlight non-breaking spaces only after strings have been escaped
4942
$target_string2 = str_replace(' ', '<span class="highlight-gray"> </span>', $target_string2);
5043

51-
switch ($current_repo) {
52-
case 'mozilla_org':
53-
$path_locale3 = VersionControl::gitPath($locale2, $current_repo, $entity);
54-
break;
55-
case 'firefox_ios':
56-
$path_locale3 = VersionControl::svnPath($locale2, $current_repo, $entity);
57-
break;
58-
default:
59-
$path_locale3 = VersionControl::hgPath($locale2, $current_repo, $entity);
60-
break;
44+
if (in_array($current_repo, ['firefox_ios', 'mozilla_org'])) {
45+
$path_locale3 = VersionControl::gitPath($locale2, $current_repo, $entity);
46+
} else {
47+
$path_locale3 = VersionControl::hgPath($locale2, $current_repo, $entity);
6148
}
6249

6350
// Link to entity

tests/units/Transvision/VersionControl.php

Lines changed: 9 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public function getVCSDP()
2121
'central', 'hg',
2222
],
2323
[
24-
'firefox_ios', 'svn',
24+
'firefox_ios', 'git',
2525
],
2626
];
2727
}
@@ -131,38 +131,15 @@ public function testHgFile($a, $b, $c, $d)
131131
->isEqualTo($d);
132132
}
133133

134-
public function svnFileDP()
134+
public function gitFileDP()
135135
{
136136
return [
137-
[
138-
'es-ES',
139-
'random_repo',
140-
'mozilla_org/firefox/os/faq.lang:c71a7a50',
141-
'https://viewvc.svn.mozilla.org/vc/?view=markup',
142-
],
143137
[
144138
'it',
145139
'firefox_ios',
146140
'firefox_ios/Client/ClearPrivateData.strings:0f4d892c',
147-
'https://viewvc.svn.mozilla.org/vc/projects/l10n-misc/trunk/firefox-ios/it/firefox-ios.xliff?view=markup',
141+
'https://github.com/mozilla-l10n/firefoxios-l10n/blob/master/it/firefox-ios.xliff',
148142
],
149-
];
150-
}
151-
152-
/**
153-
* @dataProvider svnFileDP
154-
*/
155-
public function testSvnFile($a, $b, $c, $d)
156-
{
157-
$obj = new _VersionControl();
158-
$this
159-
->string($obj->svnPath($a, $b, $c))
160-
->isEqualTo($d);
161-
}
162-
163-
public function gitFileDP()
164-
{
165-
return [
166143
[
167144
'sr',
168145
'mozilla_org',
@@ -175,6 +152,12 @@ public function gitFileDP()
175152
'mozilla_org/firefox/os/faq.lang:c71a7a50',
176153
'https://github.com/mozilla-l10n/www.mozilla.org/blob/master/es-ES/firefox/os/faq.lang',
177154
],
155+
[
156+
'fr',
157+
'unknown',
158+
'test/file.properties',
159+
'https://github.com/mozilla-l10n/unknown/blob/master/fr/test/file.properties',
160+
],
178161
];
179162
}
180163

0 commit comments

Comments
 (0)