Skip to content
This repository was archived by the owner on Apr 19, 2024. It is now read-only.

Fails on ES6 backtick quotes #5

@AArnott

Description

@AArnott

We have this code that vscode-nls-dev rewrites:

public static failedToEnumerateFilesInDir(path: string, errCode: string, errMessage: string): string {
    return localize(
        {
            key: 'Failed.To.Enumerate.Files.In.Dir',
            comment:
            [
                'Error message when failed to enumerate files in a directory.'
            ]
        },
        `Failed to enumerate files in directory '{0}'. Error code={1}, Error message={2}`,
        path,
        errCode,
        errMessage
    );
}

When targeting ES5, all is well. But once we target ES6, the backtick as a quote character is preserved:

static failedToEnumerateFilesInDir(path, errCode, errMessage) {
    return localize({
        key: 'Failed.To.Enumerate.Files.In.Dir',
        comment: [
            'Error message when failed to enumerate files in a directory.'
        ]
    }, `Failed to enumerate files in directory '{0}'. Error code={1}, Error message={2}`, path, errCode, errMessage);
}

This causes vscode-nls-dev to fail during build with this error:

libraryResourceStrings.js(661,11): second argument of a localize call must be a string literal.

For now we workaround it by changing our own use of backtick to single quotes. But that requires much more escaping in our English strings because we use single-quotes inside the localizable string.

Please enable use of backticks.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions