I want to create a resource file for Singaporean English (en-sg) named "shopping.en-sg.resx" in App_GlobalResources folder.
I get error during compilation.
Error 1 The namespace 'Resources'
already contains a definition for
'shopping' c:WINDOWSMicrosoft.NETFrameworkv2.0.50727Temporary
ASP.NET
Filesweb2cd6afe9737b0a13App_GlobalResources.vomuzavz.1.cs 26
After searching Google, I discover that "en-sg" is not a default culture and I have to create custom culture for it. I don't know the detailed steps of this.
What should I do to create the culture and remove the compilation error?
I follow the example in MSDN, create a file called "shopping.x-en-US-sample.resx" and put the following code into BasePage's function (protected override void InitializeCulture()):
CultureAndRegionInfoBuilder cib = null;
cib = new CultureAndRegionInfoBuilder(
"x-en-US-sample", CultureAndRegionModifiers.None);
CultureInfo ci = new CultureInfo("en-US");
cib.LoadDataFromCultureInfo(ci);
RegionInfo ri = new RegionInfo("US");
cib.LoadDataFromRegionInfo(ri);
cib.Register();
ci = new CultureInfo("x-en-US-sample");
However, compilation error is still exist.
UPDATED:
You can easily reproduce the problem by creating an empty website and two files "shopping.en-sg.resx" and "shopping.resx" in the app_globalresources folder.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…