[6a3a178] | 1 | /**
|
---|
| 2 | * @license
|
---|
| 3 | * Copyright Google LLC All Rights Reserved.
|
---|
| 4 | *
|
---|
| 5 | * Use of this source code is governed by an MIT-style license that can be
|
---|
| 6 | * found in the LICENSE file at https://angular.io/license
|
---|
| 7 | */
|
---|
| 8 | import * as i18n from '../i18n_ast';
|
---|
| 9 | export declare abstract class Serializer {
|
---|
| 10 | abstract write(messages: i18n.Message[], locale: string | null): string;
|
---|
| 11 | abstract load(content: string, url: string): {
|
---|
| 12 | locale: string | null;
|
---|
| 13 | i18nNodesByMsgId: {
|
---|
| 14 | [msgId: string]: i18n.Node[];
|
---|
| 15 | };
|
---|
| 16 | };
|
---|
| 17 | abstract digest(message: i18n.Message): string;
|
---|
| 18 | createNameMapper(message: i18n.Message): PlaceholderMapper | null;
|
---|
| 19 | }
|
---|
| 20 | /**
|
---|
| 21 | * A `PlaceholderMapper` converts placeholder names from internal to serialized representation and
|
---|
| 22 | * back.
|
---|
| 23 | *
|
---|
| 24 | * It should be used for serialization format that put constraints on the placeholder names.
|
---|
| 25 | */
|
---|
| 26 | export interface PlaceholderMapper {
|
---|
| 27 | toPublicName(internalName: string): string | null;
|
---|
| 28 | toInternalName(publicName: string): string | null;
|
---|
| 29 | }
|
---|
| 30 | /**
|
---|
| 31 | * A simple mapper that take a function to transform an internal name to a public name
|
---|
| 32 | */
|
---|
| 33 | export declare class SimplePlaceholderMapper extends i18n.RecurseVisitor implements PlaceholderMapper {
|
---|
| 34 | private mapName;
|
---|
| 35 | private internalToPublic;
|
---|
| 36 | private publicToNextId;
|
---|
| 37 | private publicToInternal;
|
---|
| 38 | constructor(message: i18n.Message, mapName: (name: string) => string);
|
---|
| 39 | toPublicName(internalName: string): string | null;
|
---|
| 40 | toInternalName(publicName: string): string | null;
|
---|
| 41 | visitText(text: i18n.Text, context?: any): any;
|
---|
| 42 | visitTagPlaceholder(ph: i18n.TagPlaceholder, context?: any): any;
|
---|
| 43 | visitPlaceholder(ph: i18n.Placeholder, context?: any): any;
|
---|
| 44 | visitIcuPlaceholder(ph: i18n.IcuPlaceholder, context?: any): any;
|
---|
| 45 | private visitPlaceholderName;
|
---|
| 46 | }
|
---|