support icu messageformat for translations
This commit is contained in:
parent
b5c514e1d1
commit
6d56f8b8aa
35 changed files with 839 additions and 104 deletions
35
build/intl-linter/rules/noNestedChoice.ts
Normal file
35
build/intl-linter/rules/noNestedChoice.ts
Normal file
|
@ -0,0 +1,35 @@
|
|||
// Copyright 2022 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
import type { Element } from '../utils/rule';
|
||||
import { rule } from '../utils/rule';
|
||||
|
||||
export default rule('noNestedChoice', context => {
|
||||
let insideChoice = false;
|
||||
|
||||
function check(element: Element) {
|
||||
if (insideChoice) {
|
||||
context.report(
|
||||
'Nested {select}/{plural} is not supported by Smartling',
|
||||
element.location
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
enterSelect(element) {
|
||||
check(element);
|
||||
insideChoice = true;
|
||||
},
|
||||
exitSelect() {
|
||||
insideChoice = false;
|
||||
},
|
||||
enterPlural(element) {
|
||||
check(element);
|
||||
insideChoice = true;
|
||||
},
|
||||
exitPlural() {
|
||||
insideChoice = false;
|
||||
},
|
||||
};
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue