mirror of
https://github.com/estruyf/vscode-front-matter.git
synced 2026-04-30 10:34:12 +02:00
19 lines
627 B
TypeScript
19 lines
627 B
TypeScript
import { Uri, l10n } from 'vscode';
|
|
import { Extension, Logger, parseWinPath } from '../helpers';
|
|
import { readFileAsync } from './readFileAsync';
|
|
import { join } from 'path';
|
|
|
|
export const getLocalizationFile = async () => {
|
|
try {
|
|
const localeFilePath =
|
|
l10n.uri?.fsPath ||
|
|
Uri.file(join(parseWinPath(Extension.getInstance().extensionPath.fsPath), `/l10n/bundle.l10n.json`)).fsPath;
|
|
|
|
const fileContents = await readFileAsync(localeFilePath, 'utf-8');
|
|
return fileContents;
|
|
} catch (error) {
|
|
Logger.error(`Failed to get the localization file: ${(error as Error).message}`);
|
|
return '';
|
|
}
|
|
};
|