(token, pluralToken)
| 96 | } |
| 97 | |
| 98 | token(token, pluralToken) { |
| 99 | if (typeof token == 'string') return JSON.stringify(token); |
| 100 | |
| 101 | let fn; |
| 102 | this.arguments.push(token.arg); |
| 103 | let args = [property('d', token.arg)]; |
| 104 | switch (token.type) { |
| 105 | case 'argument': |
| 106 | return this.options.biDiSupport |
| 107 | ? biDiMarkText(args[0], this.plural.id) |
| 108 | : args[0]; |
| 109 | |
| 110 | case 'select': |
| 111 | fn = 'select'; |
| 112 | if (pluralToken && this.options.strictNumberSign) pluralToken = null; |
| 113 | args.push(this.cases(token, pluralToken)); |
| 114 | this.setRuntimeFn('select'); |
| 115 | break; |
| 116 | |
| 117 | case 'selectordinal': |
| 118 | fn = 'plural'; |
| 119 | args.push( |
| 120 | token.offset || 0, |
| 121 | identifier(this.plural.id), |
| 122 | this.cases(token, token), |
| 123 | 1 |
| 124 | ); |
| 125 | this.setLocale(this.plural.id, true); |
| 126 | this.setRuntimeFn('plural'); |
| 127 | break; |
| 128 | |
| 129 | case 'plural': |
| 130 | fn = 'plural'; |
| 131 | args.push( |
| 132 | token.offset || 0, |
| 133 | identifier(this.plural.id), |
| 134 | this.cases(token, token) |
| 135 | ); |
| 136 | this.setLocale(this.plural.id, false); |
| 137 | this.setRuntimeFn('plural'); |
| 138 | break; |
| 139 | |
| 140 | case 'function': |
| 141 | switch (token.key) { |
| 142 | case 'date': |
| 143 | fn = this.setDateFormatter(token, args, pluralToken); |
| 144 | break; |
| 145 | case 'number': |
| 146 | fn = this.setNumberFormatter(token, args, pluralToken); |
| 147 | break; |
| 148 | default: |
| 149 | args.push(JSON.stringify(this.plural.locale)); |
| 150 | if (token.param) { |
| 151 | if (pluralToken && this.options.strictNumberSign) |
| 152 | pluralToken = null; |
| 153 | const s = token.param.tokens.map(tok => |
| 154 | this.token(tok, pluralToken) |
| 155 | ); |
no test coverage detected