Skip to content

Commit e27ce3f

Browse files
authored
Merge pull request #1004 from flodolo/android_l10n
Fix links for android-l10n projects
2 parents 4719efc + 86b68dd commit e27ce3f

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

app/classes/Transvision/ShowResults.php

+12
Original file line numberDiff line numberDiff line change
@@ -287,8 +287,20 @@ public static function getEditLink($tool, $repo, $key, $text, $locale)
287287
if (isset(Project::$repos_info[$repo]) && isset(Project::$repos_info[$repo]['pontoon_project'])) {
288288
$repo_data = Project::$repos_info[$repo];
289289
$project_name = $repo_data['pontoon_project'];
290+
290291
// Key is in the format project/pathtofile:stringID
291292
$resource_path = VersionControl::extractFilePath($key);
293+
294+
// android-l10n maps to different projects in Pontoon
295+
if ($project_name == 'android-l10n') {
296+
if (Strings::startsWith($resource_path, 'mozilla-lockwise')) {
297+
$project_name = 'lockwise-for-android';
298+
} else {
299+
// Default project is firefox-for-android
300+
$project_name = 'firefox-for-android';
301+
}
302+
}
303+
292304
$search_key = in_array($repo, Project::$repos_lists['text_search'])
293305
? $text
294306
: $fileAndRawString[1];

tests/units/Transvision/ShowResults.php

+16
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,22 @@ public function getEditLinkDP()
428428
'it',
429429
"&nbsp;<a class='edit_link' target='_blank' href='https://pontoon.mozilla.org/it/mozillaorg/en/banners/firefox-mobile.ftl?search=banner-firefox-mobile-get-android-title'>&lt;edit in Pontoon&gt;</a>",
430430
],
431+
[
432+
'pontoon',
433+
'android_l10n',
434+
'android_l10n/mozilla-mobile/fenix/app/src/main/res/values/strings.xml:preference_experiments',
435+
'test',
436+
'it',
437+
"&nbsp;<a class='edit_link' target='_blank' href='https://pontoon.mozilla.org/it/firefox-for-android/mozilla-mobile/fenix/app/src/main/res/values/strings.xml?search=preference_experiments'>&lt;edit in Pontoon&gt;</a>",
438+
],
439+
[
440+
'pontoon',
441+
'android_l10n',
442+
'android_l10n/mozilla-lockwise/lockwise-android/app/src/main/res/values/strings.xml:password_for',
443+
'test',
444+
'it',
445+
"&nbsp;<a class='edit_link' target='_blank' href='https://pontoon.mozilla.org/it/lockwise-for-android/mozilla-lockwise/lockwise-android/app/src/main/res/values/strings.xml?search=password_for'>&lt;edit in Pontoon&gt;</a>",
446+
],
431447
[
432448
'pontoon',
433449
'firefox_ios',

0 commit comments

Comments
 (0)