|
1 |
| -import resolve from "./resolver"; |
2 |
| -import FluentResource from "./resource"; |
| 1 | +import resolve from "./resolver.js"; |
| 2 | +import FluentResource from "./resource.js"; |
3 | 3 |
|
4 | 4 | /**
|
5 | 5 | * Message bundles are single-language stores of translations. They are
|
@@ -138,7 +138,8 @@ export default class FluentBundle {
|
138 | 138 | * @returns {Array<Error>}
|
139 | 139 | */
|
140 | 140 | addResource(res) {
|
141 |
| - const errors = res.errors.slice(); |
| 141 | + const errors = []; |
| 142 | + |
142 | 143 | for (const [id, value] of res) {
|
143 | 144 | if (id.startsWith("-")) {
|
144 | 145 | // Identifiers starting with a dash (-) define terms. Terms are private
|
@@ -196,16 +197,16 @@ export default class FluentBundle {
|
196 | 197 | return this._transform(message);
|
197 | 198 | }
|
198 | 199 |
|
199 |
| - // optimize simple-string entities with attributes |
200 |
| - if (typeof message.val === "string") { |
201 |
| - return this._transform(message.val); |
202 |
| - } |
203 |
| - |
204 | 200 | // optimize entities with null values
|
205 |
| - if (message.val === undefined) { |
| 201 | + if (message === null || message.value === null) { |
206 | 202 | return null;
|
207 | 203 | }
|
208 | 204 |
|
| 205 | + // optimize simple-string entities with attributes |
| 206 | + if (typeof message.value === "string") { |
| 207 | + return this._transform(message.value); |
| 208 | + } |
| 209 | + |
209 | 210 | return resolve(this, args, message, errors);
|
210 | 211 | }
|
211 | 212 |
|
|
0 commit comments