nikhilk/scriptsharp — Issue #115: Resources without Resx
Author: bchavez
Created: 2011-10-17 10:59:38+00:00
State: open

Hi,

I was hoping to generate resource types without having to create a Resx file.

I'm trying to achieve the following output from ScriptSharp (a global variable for a utility class):

```javascript
PhotoSize = {
Crop: 'c',
Small: 's',
Normal: 'n',
Square: 'q'
};
````

A new Dictionary("key","value") would work, but there's no way to define a global variable in an assembly by itself.

So, I found that if I do something similar to:

```
[Resources]
public static class PhotoSize
{
[PreserveCase]
public static readonly string Crop = "c";
[PreserveCase]
public static readonly string Small = "s";
[PreserveCase]
public static readonly string Normal = "n";
[PreserveCase]
public static readonly string Square = "q";
}
```

I could get close... however, the output was:

```javascript
PhotoSize = {
Crop: '',
Small: '',
Normal: '',
Square: ''
};
````

without any initialization. :(

Resx resource strings work exactly as intended; however, I'd like to explicitly define them without having to create a Resx file.

Your thoughts?

I'm hoping we could take it one step further to allow explicit variable initialization.

Thanks,
Brian