Passed
Push — trunk ( 5039ac...c81c28 )
by Christian
12:05 queued 14s
created

locale.init.ts ➔ initializeLocaleService   A

Complexity

Conditions 2

Size

Total Lines 22
Code Lines 15

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 15
dl 0
loc 22
rs 9.65
c 0
b 0
f 0
1
/**
2
 * @package admin
3
 */
4
5
// eslint-disable-next-line sw-deprecation-rules/private-feature-declarations
6
export default async function initializeLocaleService() {
7
    const factoryContainer = Shopware.Application.getContainer('factory');
8
    const localeFactory = factoryContainer.locale;
9
10
    // Register default snippets
11
    localeFactory.register('de-DE', {});
12
    localeFactory.register('en-GB', {});
13
14
    // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
15
    const snippetService = Shopware.Service('snippetService');
16
17
    if (snippetService) {
18
        // eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access
19
        await snippetService.getSnippets(localeFactory);
20
    }
21
22
    return localeFactory;
23
}
24