Programming Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsOtherProgramming Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old November 2nd, 2005, 05:33 AM
buzyonok buzyonok is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Mar 2005
Location: Israel
Posts: 114 buzyonok User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 23 h 17 m 44 sec
Reputation Power: 4
Dynamical content display

Hi guys!

I hope someone will help me to find the optimal solution for this.

I have some system that is written in asp. The problem is that I need exactly the same system in 5 different languages.
I need to display the content in different language.

I'm wondering how to do this right.
Create Data Base ?
Create one big asp file ?

If I'm creating a DB where each field is a word/sentence in different language ,it will be a table with 50 or more fileds.

If I create an asp file I will need to create an array and put words/sentences in each element.I have many files that I nedd to translate this way.


If someone has any idea it will be very helpful.

Reply With Quote
  #2  
Old November 6th, 2005, 05:58 AM
leuvenaar's Avatar
leuvenaar leuvenaar is offline
Frustrated Wizard
ASP Free Regular (2000 - 2499 posts)
 
Join Date: Apr 2005
Posts: 2,408 leuvenaar User rank is Sergeant (500 - 2000 Reputation Level)leuvenaar User rank is Sergeant (500 - 2000 Reputation Level)leuvenaar User rank is Sergeant (500 - 2000 Reputation Level)leuvenaar User rank is Sergeant (500 - 2000 Reputation Level)leuvenaar User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 1 Week 5 Days 22 h 53 m 44 sec
Reputation Power: 14
my pages are in 4 languages (usually). what i use is conditional includes which works rather complicated in ASP. I try to explain.

Put this at the top of your page (without <% %>):
Code:
<SCRIPT Language=VBScript RUNAT=SERVER>
Function getMappedFileAsString(byVal strFilename)
  Const ForReading = 1
  Dim fso
  Set fso = Server.CreateObject("Scripting.FilesystemObject")
  
  Dim ts
  Set ts = fso.OpenTextFile(Server.MapPath(strFilename), ForReading)
  getMappedFileAsString = ts.ReadAll
  ts.close
  
  Set ts = nothing
  Set fso = Nothing
End Function
</SCRIPT>

Then the conditional include of language files:
Code:
'map to the existing language files
languagefile_en = Server.MapPath("inc_language_en.asp")
languagefile_ne = Server.MapPath("inc_language_ne.asp")
languagefile_de = Server.MapPath("inc_language_de.asp")
languagefile_fr = Server.MapPath("inc_language_fr.asp")
'include appropriate language file (selection between english, dutch, german, french) 
'when no user is logged in (login.asp) then include the english library by default
'when no language is defined, then get the english include file
Dim strInclude
If str_users_language = "" Then
 strInclude = getMappedFileAsString("inc_language_en.asp")
ElseIf str_users_language = "en" Then
 strInclude = getMappedFileAsString("inc_language_en.asp")
ElseIf str_users_language = "ne" Then
 strInclude = getMappedFileAsString("inc_language_ne.asp")
ElseIf str_users_language = "de" Then
 strInclude = getMappedFileAsString("inc_language_de.asp")
ElseIf str_users_language = "fr" Then
 strInclude = getMappedFileAsString("inc_language_fr.asp")
End If
Execute strInclude

now you generate different include language files called (in your case 5)
- inc_language_en.asp
- inc_language_ne.asp
- inc_language_de.asp
- inc_language_fr.asp

which look like (no <% %>) tags!:
Code:
Function getFileName()
  Dim lsPath, arPath
  ' Obtain the virtual file path
  lsPath = Request.ServerVariables("SCRIPT_NAME")
  ' Split the path along the /s. This creates an
  ' one-dimensional array
  arPath = Split(lsPath, "/")
  ' The last item in the array contains the file name
  GetFileName =arPath(UBound(arPath,1))
End Function
'shared files
'------------------------------------------------------------------------------
If GetFileName = "index.asp" Then
  interhrm	  = "InterHRM"
  welcome	  = "Welcome to InterHRM"
  intro	   = "electronic Human Resource Management (eHRM) systems"
  service	  = "We offer you the opportunity to comply with competence- and performancemanagement by means of eHRM (the usage of internettechnology to support HRM purposes)." & "<br>" & "Practise points out that organisations which introduce eHRM solutions, get provable benefit on a diversity of fields, such as:"
  item_1	  = "lower company costs for the execution of HRM-processes, for example by decreasing the administrative HRM-tasks which come along with eHRM, shorter pass through times"
  item_2	  = "larger involvement and higher employee satisfaction: Because eHRM is a way to assign more responsibilities to the employees and managers themselves, with respect to HRM"
End If


for all 5 languages....
good luck

Reply With Quote
  #3  
Old November 7th, 2005, 01:19 AM
buzyonok buzyonok is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Mar 2005
Location: Israel
Posts: 114 buzyonok User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 23 h 17 m 44 sec
Reputation Power: 4
Thank you for your answer. Good work!

I don't understand a few things .I don't understand why not to use <%%> tags and what are you doing in the include files? Do you write a translation for each sentence?

Thank you again.

Reply With Quote
  #4  
Old November 7th, 2005, 02:26 AM
leuvenaar's Avatar
leuvenaar leuvenaar is offline
Frustrated Wizard
ASP Free Regular (2000 - 2499 posts)
 
Join Date: Apr 2005
Posts: 2,408 leuvenaar User rank is Sergeant (500 - 2000 Reputation Level)leuvenaar User rank is Sergeant (500 - 2000 Reputation Level)leuvenaar User rank is Sergeant (500 - 2000 Reputation Level)leuvenaar User rank is Sergeant (500 - 2000 Reputation Level)leuvenaar User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 1 Week 5 Days 22 h 53 m 44 sec
Reputation Power: 14
Quote:
Originally Posted by buzyonok
Thank you for your answer. Good work!

I don't understand a few things .I don't understand why not to use <%%> tags and what are you doing in the include files? Do you write a translation for each sentence?

Thank you again.


The reason not to use <% %> is because the first code part is written in VB and is executing the include files. VB doesn't need these tags so thats the reason.
In the include files (in your case you will have 5 separate include files for each language) you define for each sentence the translation as a string. When calling a variable in your code, then the string will be displayed.

The advantage of this method is its very fast in loading.
here is some more info:

http://www.4guysfromrolla.com/webtech/022504-1.shtml

Reply With Quote
Reply

Viewing: ASP Free ForumsOtherProgramming Help > Dynamical content display


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
Stay green...Green IT