-
Notifications
You must be signed in to change notification settings - Fork 24.8k
/
translation_parser.ts
37 lines (34 loc) 路 1.17 KB
/
translation_parser.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import {傻MessageId, 傻ParsedTranslation} from '@angular/localize/private';
/**
* An object that holds translations that have been parsed from a translation file.
*/
export interface ParsedTranslationBundle {
parsedLocale: string|undefined;
parsedTranslations: Record<傻MessageId, 傻ParsedTranslation>;
}
/**
* Implement this interface to provide a class that can parse the contents of a translation file.
*/
export interface TranslationParser {
/**
* Returns true if this parser can parse the given file.
*
* @param filePath The absolute path to the translation file.
* @param contents The contents of the translation file.
*/
canParse(filePath: string, contents: string): boolean;
/**
* Parses the given file, extracting the target locale and translations.
*
* @param filePath The absolute path to the translation file.
* @param contents The contents of the translation file.
*/
parse(filePath: string, contents: string): ParsedTranslationBundle;
}