feat(compiler): digest methods return i18nMessage id if sets
This commit is contained in:
parent
6dd5201765
commit
562f7a2f8b
|
@ -9,13 +9,13 @@
|
||||||
import * as i18n from './i18n_ast';
|
import * as i18n from './i18n_ast';
|
||||||
|
|
||||||
export function digest(message: i18n.Message): string {
|
export function digest(message: i18n.Message): string {
|
||||||
return sha1(serializeNodes(message.nodes).join('') + `[${message.meaning}]`);
|
return message.id || sha1(serializeNodes(message.nodes).join('') + `[${message.meaning}]`);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function decimalDigest(message: i18n.Message): string {
|
export function decimalDigest(message: i18n.Message): string {
|
||||||
const visitor = new _SerializerIgnoreIcuExpVisitor();
|
const visitor = new _SerializerIgnoreIcuExpVisitor();
|
||||||
const parts = message.nodes.map(a => a.visit(visitor, null));
|
const parts = message.nodes.map(a => a.visit(visitor, null));
|
||||||
return computeMsgId(parts.join(''), message.meaning);
|
return message.id || computeMsgId(parts.join(''), message.meaning);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue