(key, ord)
| 194 | } |
| 195 | |
| 196 | setLocale(key, ord) { |
| 197 | const prev = this.runtimeIncludes(key, 'locale'); |
| 198 | const { getCardinal, getPlural, isDefault } = this.plural; |
| 199 | let pf; |
| 200 | if (!ord && isDefault && getCardinal) { |
| 201 | if (prev) return; |
| 202 | pf = n => getCardinal(n); |
| 203 | pf.module = CARDINAL_MODULE; |
| 204 | pf.toString = () => String(getCardinal); |
| 205 | } else { |
| 206 | // overwrite a previous cardinal-only locale function |
| 207 | if (prev && (!isDefault || prev.module === PLURAL_MODULE)) return; |
| 208 | pf = (n, ord) => getPlural(n, ord); |
| 209 | pf.module = isDefault ? PLURAL_MODULE : getPlural.module; |
| 210 | pf.toString = () => String(getPlural); |
| 211 | } |
| 212 | pf.type = 'locale'; |
| 213 | this.runtime[key] = pf; |
| 214 | } |
| 215 | |
| 216 | setRuntimeFn(key) { |
| 217 | if (this.runtimeIncludes(key, 'runtime')) return; |
no test coverage detected