Closed stepan662 closed 3 months ago
Seems like --default-namespace
is still ignored in @tolgee-key
comments in v2.1.1. Example code:
// @tolgee-key { "ns": "ui", "key": "errors.cy1001", "defaultValue": "User not found." }
(the above comment works as expected, ui
namespace assumed)
// @tolgee-key { "key": "errors.cy1001", "defaultValue": "User not found." }
(the above comment doesn't work; it assumes default
namespace instead of ui
)
tolgee sync --default-namespace ui -pt "./src/**/*.ts" "./src/**/*.vue"
(the above is the command I run).
Maybe the issue is specific to JSON comments?
Or maybe it happens when there's no t
function at all?
Try to add this test (copy-pasted-and-modified your test):
it('respects default namespace in magic comments with JSON', async () => {
const report = await getReport(
`
// @tolgee-key { "key": "key-override", "defaultValue": "Default Text." }
`,
FILE_NAME,
'react',
{ defaultNamespace: 'namespace' }
);
expect(report.keys).toEqual([
{ keyName: 'key-override', namespace: 'namespace', defaultValue: 'Default Text.', line: 2 },
]);
});
Ah you are right, I've fixed in on only one place, but the case when it doesn't override anything in code was treated separately. So I've unified the cases into one function, where it's fixed.
I confirm #94 fixes my issue. Thanks again Stephan!
:tada: This PR is included in version 2.1.1 :tada:
The release is available on:
Your semantic-release bot :package::rocket: