Skip to content

Commit 1f99fe2

Browse files
authored
Always use en-US as reference for 'all projects' search (#1035)
1 parent 9b15f89 commit 1f99fe2

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

app/classes/Transvision/Utils.php

+15-2
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,19 @@ public static function getRepoStrings($locale, $repository, $flat = true)
163163
: [$repository];
164164

165165
foreach ($repositories as $repository) {
166-
$file = TMX . "{$locale}/cache_{$locale}_{$repository}.php";
166+
# Ignore meta project (all_projects)
167+
if (Project::isMetaRepository($repository)) {
168+
continue;
169+
}
170+
/*
171+
If the locale requested is en-US, we assume that the research
172+
needs to look at the reference locale (which might be "en"
173+
for some projects).
174+
*/
175+
$repo_locale = ($locale == 'en-US')
176+
? Project::getReferenceLocale($repository)
177+
: $locale;
178+
$file = TMX . "{$repo_locale}/cache_{$repo_locale}_{$repository}.php";
167179
if (! is_file($file)) {
168180
continue;
169181
}
@@ -183,7 +195,8 @@ public static function getRepoStrings($locale, $repository, $flat = true)
183195
}
184196

185197
/**
186-
* Return a flat array of entity items with structure (repo, entity, entity's text)
198+
* Return a flat array of entity items with structure (repo, entity,
199+
entity's text)
187200
*
188201
* @param string $tmx Array with strings organized per repo
189202
*

0 commit comments

Comments
 (0)