Reputation: 1143
Thanks in advance, i know this is very repeated and very much asked question but i did not get any proper solutions i refer lots of sites for this.
problem: i am developing, and ordering site and that is needed to multiple language support like English, Spanish, French, Arabic and almost 10 languages are there. how can i manage all the things from css to images, record fetching from database lots of things are there in my mind to set things.
i can use one solution i can create field for each language in table like for Description i need to keep filed for English, Spanish like this....
What is the best way to use dynamic language translation without any third party tool used.
Please tell me solution.
if you not getting my question please ask me.
i need desperate help
thanks in advance
Upvotes: 0
Views: 1980
Reputation: 2170
Well as far as database thing is concerned, the solution is you will have a Languages
table and your every user will have a language in database against its record or user can select language from dropdown on the page. All the entity tables like i say, UserStatus
, UserTypes
etc will have a relevant lang table like: UserStatus_Lang
, which will hold the language specific texts, like:
UserStatus Table
UserStatusId
1
UserStatus_Lang
UserStatusId_FK LangId_FK Text
1 1 Online
1 2 ******
While saving you will save Id of entity table but while displaying you will show text from _Lang
table.
Than for controls like labels etc on page, you will create a table Pages
, which will hold page names of your pages, than another table PageControls
to hold controls that exist on your page and than another table PageControlsText
which will hold language specific texts against the page controls. In Page_Init event you will fetch pagecontrols and their texts (according to selected language) from database and set text of pagecontrols by searching them on the page.
I hope you have got some idea about this implementation. ==============================MODIFICATION===================================
PAGE TABLE
PAGEID PAGENAME [OTHER COLUMNS]
PAGE CONTROLS TABLE
PAGECONTROLID PAGEID_FK PAGECONTROLNAME [OTHER COLUMNS]
PAGE CONTROLS TEXT TABLE
PAGECONTROLID_FK LANGID_FK PAGECONTROLTEXT
As far as your description thing is concerned you will have to do it like in 2 tables TABLE1
ID ITEM_NAME
than another table TABLE1_LANG
ID_FK LANGID_FK DESCRIPTION
By using this approach you will not need to modify your structure, when new language is introduced in the system.
Upvotes: 0
Reputation: 28970
You can base your work on localisation and globalisation
Link : http://msdn.microsoft.com/fr-fr/library/ms247246%28v=vs.100%29.aspx
In order to begin you can test theses functionalities
Generating Default Resource File :
In Visual Studio designer, click the designer surface or a control.
Select Tools --> Generate Local Resource
An XML - based local resource file for the Web page in the App_LocalResources folder with Text and ToolTip values for all existing controls on the page, as well as the page title will be generated.
Generating Resource Files for Other Cultures:
In Solution Explorer
Right click the 'Default.aspx.resx' file and click the Copy
Right click the App_LocalResources folder and click the Paste
Right click the 'Copy of Default.aspx.resx' and click the Rename
Type the new name for the resource file that includes the new language and culture code before the extension.
Upvotes: 1