mirror of https://github.com/BOINC/boinc.git
Remove duplicates from merged textgroup PO file when updating strings at Transifex
(DBOINCP-141)
This commit is contained in:
parent
737c481cc6
commit
ce11ffa3ca
|
@ -658,9 +658,26 @@ function boinctranslate_get_po($langcode, $type = 'standard') {
|
|||
default:
|
||||
}
|
||||
|
||||
// Merge textgroup strings together for export as one file
|
||||
foreach ($textgroups as $textgroup) {
|
||||
$strings += _locale_export_get_strings($language, $textgroup);
|
||||
}
|
||||
ksort($strings);
|
||||
$unique_strings = array();
|
||||
$duplicate_strings = array();
|
||||
foreach ($strings as $id => $string) {
|
||||
// Build a set of duplicate strings
|
||||
if (!isset($unique_strings[$string['source']])) {
|
||||
$unique_strings[$string['source']] = $id;
|
||||
}
|
||||
else {
|
||||
$duplicate_strings[] = $id;
|
||||
}
|
||||
}
|
||||
foreach ($duplicate_strings as $id) {
|
||||
// Remove any duplicate source strings from the original array
|
||||
unset($strings[$id]);
|
||||
}
|
||||
if ($langcode != 'en') {
|
||||
// If not the source language, remove untranslated strings from the ouput
|
||||
foreach ($strings as $i => $string) {
|
||||
|
|
Loading…
Reference in New Issue