diff --git a/src/yamlServerInit.ts b/src/yamlServerInit.ts index 9a8f82f4f..77767b182 100644 --- a/src/yamlServerInit.ts +++ b/src/yamlServerInit.ts @@ -59,7 +59,7 @@ export class YAMLServerInit { public async setupl10nBundle(params: InitializeParams): Promise { const __dirname = path.dirname(__filename); - const l10nPath: string = params.initializationOptions?.l10nPath || path.join(__dirname, '../l10n'); + const l10nPath: string = params.initializationOptions?.l10nPath || path.join(__dirname, '../../../l10n'); const locale: string = params.locale || 'en'; if (l10nPath) { const bundleFile = !fs.existsSync(path.join(l10nPath, `bundle.l10n.${locale}.json`)) diff --git a/test/bundlel10n.test.ts b/test/bundlel10n.test.ts index fc89f8b21..c449385e5 100644 --- a/test/bundlel10n.test.ts +++ b/test/bundlel10n.test.ts @@ -10,6 +10,7 @@ import { schemaRequestHandler, workspaceContext } from '../src/languageservice/s import { TestTelemetry } from './utils/testsTypes'; import { YAMLServerInit } from '../src/yamlServerInit'; import * as l10n from '@vscode/l10n'; +import * as path from 'path'; describe('Bundle l10n Test', () => { let serverInit: YAMLServerInit; @@ -44,6 +45,9 @@ describe('Bundle l10n Test', () => { processId: 0, rootUri: '', capabilities: undefined, + initializationOptions: { + l10nPath: path.join(__dirname, '../l10n'), + }, }); }); @@ -54,6 +58,9 @@ describe('Bundle l10n Test', () => { processId: 0, rootUri: '', capabilities: undefined, + initializationOptions: { + l10nPath: path.join(__dirname, '../l10n'), + }, }); assert.equal(l10n.t('Default Value'), 'Valeur par défaut'); }); @@ -64,6 +71,9 @@ describe('Bundle l10n Test', () => { processId: 0, rootUri: '', capabilities: undefined, + initializationOptions: { + l10nPath: path.join(__dirname, '../l10n'), + }, }); assert.equal(l10n.t('Default Value'), 'Default value'); });