View previous topic :: View next topic |
Author |
Message |
Dierk Droth
Joined: 16 Nov 2010 Posts: 27
|
Posted: Wed Dec 15, 2010 3:34 pm Post subject: Generated resource IDs invalid? |
|
|
I just found that the generated resource IDs might have a dot char '.'. This generates a warning in VS2010:
The resource name 'XXXX.Text' is not a valid identifier.
Shouldn't rather a underscore char '_' be used on generating resource IDs??
Thanks |
|
Back to top |
|
|
Infralution
Joined: 28 Feb 2005 Posts: 5027
|
Posted: Wed Dec 15, 2010 9:46 pm Post subject: |
|
|
Resx keys containing dots (".") are perfectly legal. This warning is only generated if you have changed the Custom Tool property for the resx to "ResXFileCodeGenerator" to generate a class wrapper for the resources. Since the ResxExtension doesn't doesn't use class wrappers Globalizer.NET was not designed to facilitate their use (by avoiding using dots in keys). Interestingly the ResXFileCodeGenerator actually copes with dots in key names and just converts them automatically to underscores. So it seems that maybe this warning you get when opening the resources in the visual studio editor is obsolete. You can quite happily ignore the warning.
We maybe able to provide an option in a future release to enable the naming convention for WPF resources to be changed - but as this would break existing code we can't simply change the default naming convention that Globalizer uses. _________________ Infralution Support |
|
Back to top |
|
|
Dierk Droth
Joined: 16 Nov 2010 Posts: 27
|
Posted: Thu Dec 16, 2010 6:26 am Post subject: |
|
|
Thanks for looking into.
I agree, having an option to strictly generate '_' and no '.' would be the way to go. |
|
Back to top |
|
|
Infralution
Joined: 28 Feb 2005 Posts: 5027
|
Posted: Fri Jul 22, 2011 3:53 am Post subject: |
|
|
Version 3 of Globalizer has now been released and includes a "Use compliant resource names" option in the XAML Settings. If checked then Globalizer will generate resource names with underscores instead of "."s to allow the ResxFileCodeGenerator to be used without warnings on resx files created by Globalizer. By default this option is checked for new Workspaces but unchecked for Workspaces created used Version 2 (so that the behaviour doesn't change unless you explicitly want it to.
See the Release Announcement for more details. _________________ Infralution Support |
|
Back to top |
|
|
|