2

I am wondering if there is a method to take a RESX file, and feed it into a TS file/some other script, that outputs a new TypeScript declaration file. This could run perhaps at build time.

Right now I don't think there are any built-in typescript methods to iterate through a ResX file, so I think this would need to be done using C#.

It looks like I can iterate through a ResX file with a for loop as shown above, then create a new txt file and write the output in there, then change the file extensions from txt to .d.ts.

Curious on thoughts of this approach or if I should try something else besides native C# (maybe T4 text templating, or some bash scripting?).


The final output would be something like output.d.ts

export interface MyResXStrings extends SomeTypeScript Interface { 
    WelcomeTitle: string;  
    WelcomeSubtitle: string; 
} 

which was created from MyResxStrings.resx, which has WelcomeTitle, and WelcomeSubtitle.

MMM
  • 315
  • 1
  • 6
  • 19

0 Answers0