Localizing WebForms without excessively using meta:resourcekey
I was just given a project that needs to be localized.
I just ran into meta:resourcekey and how it's used in conjunction with local resource files.My question is: do I have to do it this way?
Consider this example right off MSDN:<asp:Button ID="Button1" runat="server" Text="Defau开发者_C百科ltText"
meta:resourcekey="Button1" />
If I'm reading this for the first time (which I am), I'd say "why specify Button1
twice?"
<@ Page @>
already has Culture
set to auto
, and there are local resource files, go and find each control's local resources, if any, without having to do this double-mention for EVERY single control on the page.
I looked at a page we already have that does that and it just looks like clutter, if you ask me.
Am I missing something here?
Or is this method obsolete and there is a better way to do it? All input (+/-) is appreciated. Thanks!I agree that specifying the control identifier a second time in the meta:resourcekey
attribute seems redundant, but it's there for a good reason.
Suppose you're maintaining an application localized in, say, 42 languages. Suppose translations for some of those languages are outsourced to, say, 6 different contractors.
Now imagine you absolutely have to change the ID
of your button from Button1
to defaultButton
. What would be the best way to do that?
Change the
ID
attribute, leavemeta:resourcekey
as it is, and be on your merry way, orChange the
ID
attribute, then modify dozens of resource files so they use the newID
, then give a call to all your contractors asking them to modify the resource files they provide you?
精彩评论