wrong 1.1 resx key names ! RRS feed

  • Question

  • User1384843640 posted
    all my applications since net 1.0 are working with resx file and key names as

    <data name="Contact.Field.5">
            <value>Contact me !</value>

    now once more Microsoft has changed all and  Contact.Field.5  doesnt work as valid key name !
    how can I build a key name with a valid separator ? Contact?Field?5

    thank you

    Wednesday, March 1, 2006 4:53 AM

All replies

  • User1183903743 posted

    Actually, the period is an allowed separator but only for local resources which did not exist in v1.x The dot has a meanig there. The "mata" tag maps to a control, but controls have more than one localizable props/fields so the dot is used as a domain separator to fit that one-to-many relationship into the flat-hash schema of a resx data node.

    For global resources you would have to replace it with an underscore separator. The reason for the change is the resource name is turned into a static field in generated CLR code and variable naming rules have to now be enforced, for what used to be just an xml attribute/.resources key (both pretty liberal).

    Global resources probably map closer to the v1.x resource but still not quite. So really BOTH types are new and not backwards compatible. Be prepared to redo them all. Even if you did a massive find-n-replace, and you packed all the resx files in the designated special directory, you would achieve backwards compatibility but still be using only a fraction of the features. The way satellite assemblies are broken down by special folder as opposed to one monolithic one is different too, and IMO better.

    In retrospect, from xm point of view, dot-delimiting an attribute was not such a great idea in the first place, and it is now coming to bite you.:)

    Embrace progress, don' fight it!

    Sunday, March 5, 2006 12:31 PM