Skip to content

Commit

Permalink
Merge pull request #1004 from flodolo/android_l10n
Browse files Browse the repository at this point in the history
Fix links for android-l10n projects
  • Loading branch information
flodolo authored Mar 20, 2021
2 parents 4719efc + 86b68dd commit e27ce3f
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
12 changes: 12 additions & 0 deletions app/classes/Transvision/ShowResults.php
Original file line number Diff line number Diff line change
Expand Up @@ -287,8 +287,20 @@ public static function getEditLink($tool, $repo, $key, $text, $locale)
if (isset(Project::$repos_info[$repo]) && isset(Project::$repos_info[$repo]['pontoon_project'])) {
$repo_data = Project::$repos_info[$repo];
$project_name = $repo_data['pontoon_project'];

// Key is in the format project/pathtofile:stringID
$resource_path = VersionControl::extractFilePath($key);

// android-l10n maps to different projects in Pontoon
if ($project_name == 'android-l10n') {
if (Strings::startsWith($resource_path, 'mozilla-lockwise')) {
$project_name = 'lockwise-for-android';
} else {
// Default project is firefox-for-android
$project_name = 'firefox-for-android';
}
}

$search_key = in_array($repo, Project::$repos_lists['text_search'])
? $text
: $fileAndRawString[1];
Expand Down
16 changes: 16 additions & 0 deletions tests/units/Transvision/ShowResults.php
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,22 @@ public function getEditLinkDP()
'it',
"&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>",
],
[
'pontoon',
'android_l10n',
'android_l10n/mozilla-mobile/fenix/app/src/main/res/values/strings.xml:preference_experiments',
'test',
'it',
"&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>",
],
[
'pontoon',
'android_l10n',
'android_l10n/mozilla-lockwise/lockwise-android/app/src/main/res/values/strings.xml:password_for',
'test',
'it',
"&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>",
],
[
'pontoon',
'firefox_ios',
Expand Down

0 comments on commit e27ce3f

Please sign in to comment.