Answered by:
How to manually set which localization file (resx) to load up depending on user

Question
-
User468878487 posted
Hi,
I want to use localization as user base and not language base.
I would like to name my resx to default.aspx.ABC where ABC is the user's name.
How do i manually specify which resx file the page should load up?
Thanks
Friday, September 10, 2010 6:25 AM
Answers
-
User-25924017 posted
How would i change the Class name depending on the user in the code?Tricky, I tried some syntax for dynamic name declaratively in markup but seems not possible but you can do it programatically.
Came across this thread for that:
http://forums.asp.net/p/1570692/3936214.aspx
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Friday, September 10, 2010 8:28 AM
All replies
-
User-25924017 posted
If you are using localization as you said, does not matter if you use implicit using meta attribute or explicit using Resource builder <%$Resources:Class,ResourceID%> (class name is not required if you use local resource file, asp.net will automatically do the matching with page name or control name), you can not have your own custom file name.
The thing you want to achieve can be implemented using global resource file, using explicit way: <%$Resources:Class,ResourceID%>
The naming convention required:
-
For global resource files:
name123.language.resx //Here name part you can utilize for username (same is applicable if you create satellite assembly)
name123.language-culture.resx
Then you can use it like this:
<asp:Button ID="Button1" runat="server" Text="<%$ Resources:name123, Button1Caption %>" />
-
For local resource files: //Here it should be page name or control name, no custom name...possible
pageOrControlName.extension.language.resx
pageOrControlName.extension.language-culture.resx
I hope I made it clear.
Friday, September 10, 2010 7:20 AM -
-
User468878487 posted
Thanks for the reply.
How would i change the Class name depending on the user in the code?
Friday, September 10, 2010 7:59 AM -
User-25924017 posted
How would i change the Class name depending on the user in the code?Tricky, I tried some syntax for dynamic name declaratively in markup but seems not possible but you can do it programatically.
Came across this thread for that:
http://forums.asp.net/p/1570692/3936214.aspx
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Friday, September 10, 2010 8:28 AM