mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-03 02:25:34 +00:00
Bug 1613569 - Deduplicate resources when generating bundles. r=stas
Differential Revision: https://phabricator.services.mozilla.com/D62621 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
24e4bee487
commit
3d1443faf0
@ -134,10 +134,11 @@ class L10nRegistryService {
|
||||
* @returns {AsyncIterator<FluentBundle>}
|
||||
*/
|
||||
async* generateBundles(requestedLangs, resourceIds) {
|
||||
const resourceIdsDedup = Array.from(new Set(resourceIds));
|
||||
const sourcesOrder = Array.from(this.sources.keys()).reverse();
|
||||
const pseudoNameFromPref = Services.prefs.getStringPref("intl.l10n.pseudo", "");
|
||||
for (const locale of requestedLangs) {
|
||||
for await (const dataSets of generateResourceSetsForLocale(locale, sourcesOrder, resourceIds)) {
|
||||
for await (const dataSets of generateResourceSetsForLocale(locale, sourcesOrder, resourceIdsDedup)) {
|
||||
const bundle = new FluentBundle(locale, {
|
||||
...MSG_CONTEXT_OPTIONS,
|
||||
transform: PSEUDO_STRATEGIES[pseudoNameFromPref],
|
||||
@ -166,10 +167,11 @@ class L10nRegistryService {
|
||||
* @returns {Iterator<FluentBundle>}
|
||||
*/
|
||||
* generateBundlesSync(requestedLangs, resourceIds) {
|
||||
const resourceIdsDedup = Array.from(new Set(resourceIds));
|
||||
const sourcesOrder = Array.from(this.sources.keys()).reverse();
|
||||
const pseudoNameFromPref = Services.prefs.getStringPref("intl.l10n.pseudo", "");
|
||||
for (const locale of requestedLangs) {
|
||||
for (const dataSets of generateResourceSetsForLocaleSync(locale, sourcesOrder, resourceIds)) {
|
||||
for (const dataSets of generateResourceSetsForLocaleSync(locale, sourcesOrder, resourceIdsDedup)) {
|
||||
const bundle = new FluentBundle(locale, {
|
||||
...MSG_CONTEXT_OPTIONS,
|
||||
transform: PSEUDO_STRATEGIES[pseudoNameFromPref],
|
||||
|
Loading…
Reference in New Issue
Block a user