Last post Nov 16, 2011 05:14 PM by hsobhy
Dec 29, 2010 01:33 PM|DrZ3D|LINK
i want to create a multi languages website with xml file
actually i saw the yaf use this method and i also want to use it in my website with some difrent
the xml file that use yaf look like this:
<?xml version="1.0" encoding="utf-8"?>
<Resources xmlns:xml="http://www.w3.org/XML/1998/namespace" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" language="English" code="en">
<Resource tag="TITLE">YetAnotherForum.NET Help</Resource>
<Resource tag="SUBTITLE">Forum Help</Resource>
now i need to create a class that read the xml file and create some function that return the words like:
Language.Title() will return the Title word as string
can some one tell me how can get the information that i need or help me to write this class
Dec 31, 2010 03:37 AM|vijaypant|LINK
Hi, no need to implement custom api for creating multilingual site. Check this tutorial:
Dec 31, 2010 10:12 AM|DrZ3D|LINK
thanks for your replay
the reson that i use xml file is, i want to give the website owner that access if he/she need to create his/her owne language file can do that.
but if i use resource file to do that the website owner have to install VS to create his/her owne resource file
Jan 01, 2011 12:38 AM|sandy060583|LINK
Here is the code to fetch value from resource file :
/// method for reading a value from a resource file
/// (.resx file)
/// <param name="file">file to read from</param>
/// <param name="key">key to get the value for</param>
/// <returns>a string value</returns>
public string ReadResourceValue(string file, string key)
//value for our return value
string resourceValue = string.Empty;
// specify your resource file name
string resourceFile = file;
// get the path of your file
string filePath = System.AppDomain.CurrentDomain.BaseDirectory.ToString();
// create a resource manager for reading from
//the resx file
ResourceManager resourceManager = ResourceManager.CreateFileBasedResourceManager(resourceFile, filePath, null);
// retrieve the value of the specified key
resourceValue = resourceManager.GetString(key);
catch (Exception ex)
resourceValue = string.Empty;
Now you can use this code to fetch key value , you just need to pass your xml filename & key , method will return value of the key.
refere this link before using this code :
Hope this will help !!!
Jan 01, 2011 02:36 PM|vijaypant|LINK
Hi, check this article. This article will use a database for storing the multilingual content but the idea is the same for the xml file too.
Nov 16, 2011 05:14 PM|hsobhy|LINK
Hi Sandy and evryone,
I was searching a lot for such technique to handle my website language resources. Actually I'm new with globalization and localization issues and currently reached to run my websites under different cultures using the RESX resources in VS.
My request is if you may have time to explain the function you provided and tell me the required/supported XML file with an example(s) for calling the keys values through my ASPs and code behind.
thank you in advance for help.