From 05e784d28c05636e63ba90f06300324d15931cbe Mon Sep 17 00:00:00 2001 From: aleksandar-manukov <34056917+aleksandar-manukov@users.noreply.github.com> Date: Tue, 28 Nov 2017 11:22:53 +0200 Subject: [PATCH] Fix for the dot problem in the class name If you have a resx file named for example Translations.nl.resx, the module will generate a ts file with a class named Translations.nl which is not a correct class name. With this change the class name will be Translations_nl which is a correct class name and you can continue using the generated ts files as you want. --- index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.ts b/index.ts index d6e8f6e..d2c83bc 100644 --- a/index.ts +++ b/index.ts @@ -60,7 +60,7 @@ export function execute(typeScriptResourcesNamespace: string, virtualResxFolder: function convertXmlToTypeScriptModelFile(xmlObject: any, resxFilename: string, typeScriptResourcesNamespace: string, virtualTypeScriptFolder: string): void { const projectRoot = getProjectRoot(); const relativeResxFilename = resxFilename.replace(projectRoot, "").replace(/\\/g, "/"); - const className = resxFilename.substr(resxFilename.lastIndexOf("\\") + 1).replace('.resx', ''); + const className = resxFilename.substr(resxFilename.lastIndexOf("\\") + 1).replace('.resx', '').replace('.', '_'); const resources: Array = []; let content = '// TypeScript Resx model for: ' + relativeResxFilename + '\n' + '// Auto generated by resx-to-typescript (npm package)' + '\n' + '\n';