Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Character day of week (cdow()) or cmonth() in VFP into german -are there settings in the VFP? 6

Status
Not open for further replies.

german12

Programmer
Nov 12, 2001
563
DE
or has that to be programmed .
I know, that sounds not international, but....
as one could transform by "set date german" it could be that a setting exists like "set cdow() german (french, italy etc.")
I did not find it.
How do you manage that?

English German

Monday - Montag
Tuesday - Dienstag
Wednesday - Mittwoch
Thursday - Donnerstag
Friday - Freitag
Saturday - Samstag
Sunday - Sonntag


January - Januar
February - Februar
March - März
April - April
May - Mai
June - Juni
July - Juli
August - August
September - September
October - Oktober
November - November
December - Dezember


Peace worldwide - it starts here...
 
Hi,

I work with ARRAYS. Sketch of code below.

Code:
LOCAL laDays[7,2]

laDays[1,1] = "Monday"
laDays[1,2] = "Montag"

laDays[2,1] = "Tuesday"
laDays[2,2] = "Dienstag"

laDays[3,1] = "Wednesday"
laDays[3,2] = "Mittwoch"

...

? laDays(ASCAN(laDays, CDOW(DATE())), 2)

hth

MarK
 
Hi,

Below the code of a fully working CDOW() translation procedure. I added this method to my base form class and call it with TRCdow(dMyDate, cMyLanguageCode) - dMyDate is any date whereas cMyLanguageCode is "FR", "DE" or "LU". I have a similar method for the months.

Code:
PARAMETERS tdDate, tcLanguage

IF PARAMETERS() != 2

	= MESSAGEBOX("Please call developer", 16, "CDOW Translation")

ELSE 

	LOCAL liLCode as Integer, liRow as Integer 
	LOCAL ARRAY laDays[7, 4]

	laDays[1,1] = "Monday"
	laDays[1,2] = "Lundi"
	laDays[1,3] = "Montag"
	laDays[1,4] = "Meindeg"

	laDays[2,1] = "Tuesday"
	laDays[2,2] = "Mardi"
	laDays[2,3] = "Dienstag"
	laDays[2,4] = "Densdeg"

	laDays[3,1] = "Wednesday"
	laDays[3,2] = "Mercredi"
	laDays[3,3] = "Mittwoch"
	laDays[3,4] = "Mettwoch"

	laDays[4,1] = "Thursday"
	laDays[4,2] = "Jeudi"
	laDays[4,3] = "Donnerstag"
	laDays[4,4] = "Donneschdeg"

	laDays[5,1] = "Friday"
	laDays[5,2] = "Vendredi"
	laDays[5,3] = "Freitag"
	laDays[5,4] = "Freideg"

	laDays[6,1] = "Saturday"
	laDays[6,2] = "Samedi"
	laDays[6,3] = "Samstag"
	laDays[6,4] = "Samsdeg"

	laDays[7,1] = "Sunday"
	laDays[7,2] = "Dimanche"
	laDays[7,3] = "Sonntag"
	laDays[7,4] = "Sonndeg"

	IF TYPE("tdDate") != "D"
		tdDate = DATE()
	ENDIF 

	IF TYPE("tcLanguage") = "C"
		liLCode = ICASE(tcLanguage = "FR", 2, tcLanguage = "DE", 3, tcLanguage = "LU", 4, 1)
	ELSE
		liLCode = 1
	ENDIF 

	liRow = ASUBSCRIPT(laDays, ASCAN(laDays, CDOW(tdDate), 1, -1, 1, 1), 1)

	RETURN laDays(liRow, liLCode)
ENDIF

hth

MarK

 
Isn't this done automatically by the German resource file? If you include VFP9rdeu.dll in your run-time distribution, you should get all the English-language strings translated into German. I'm not sure about this, but it might be worth checking.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Hi Mike,

Maybe, but afaik I'm not able to have all three VFP9r*.DLL (DEU, ENU, FRA) active at the same time. Furthermore there is no "VFP9rLUX". In our multi-language situation I need however the CDOW() awa the CMONTH() in English, in French, in Luxembourgish and in German.

BTW do you have a VFP9rSCO.DLL ? [wink]

MarK
 
Mark, of course you are right about only having one VFP9r*.DLL active at a time. In that case, your custom routine is just what's needed.

In any case, I'm not sure if these DLLs affect the output of things like CDOW(). Perhaps they are only for things like "Yes / No / Cancel".

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Hi Mike,

Mike said:
In any case, I'm not sure if these DLLs affect the output of things like CDOW().

I checked, they do - but since only one VFP9r*.DLL can be active at a time, you'll have to rely on custom routines in a multi-language environment.

MarK
 
Thank you very much, MM (=Mark & Mike).
Your considerations help me a lot to create a program
in which the German names for calendar days and months appear.
For me it is not a problem to live with the names that VFP offers, but this is not the case with all friends, e.g. if they never had English at school.

Stay healthy.

Klaus


Peace worldwide - it starts here...
 
by coincidence (?) Doug Hennig just posted how to do this via dotNet and system.globalization on his blog

hth

n
 
Hi,

...

and a demo with the translated days and months. Run the code. Enjoy.

Code:
PUBLIC goForm

goForm = CREATEOBJECT("MyForm")
goForm.Show()

READ EVENTS

CLOSE ALL
CLEAR ALL 

**********

DEFINE CLASS MyForm as Form
	Width = 540
	Height = 360
	MinWidth = This.Width
	MinHeight = This.Height
	MaxWidth = This.Width
	Caption = "Multilingual form"
	AutoCenter = .T.
	ShowTips = .T.
	Themes = .F.
	
	ADD OBJECT lblMLCDoW as Label WITH ;
		Top = 36, ;
		Left = 144, ;
		AutoSize = .T., ;
		Caption = CDOW(DATE()) + " - " + CMONTH(DATE())		

	ADD OBJECT lblLanguage as Label WITH ;
		Top = 36, ;
		Left = 60, ;
		AutoSize = .T., ;
		Caption = "Language"		

	ADD OBJECT cboLanguage AS ComboBox WITH ;
		Top = 60, ;
		Left = 60, ;
		Width = 72, ;
		Style = 2, ;
		RowSourceType = 1, ;
		RowSource = "EN,FR,DE,LU", ;
		Value = "EN"
		
		PROCEDURE cboLanguage.InteractiveChange()
			ThisForm.lblLanguage.Caption = ;
				ICASE(This.Value = "EN", "Language", This.Value = "FR", "Langue", This.Value = "DE", "Sprache", "Sprooch")
				
			ThisForm.txtDate.LostFocus()

		ENDPROC 

	ADD OBJECT txtDate as TextBox WITH ;
		Top = 60, ;
		Left = 144, ;
		Value = DATE()
		
		PROCEDURE txtDate.LostFocus()
			ThisForm.lblMLCdoW.Caption = TRCDoW(This.Value, ALLTRIM(ThisForm.cboLanguage.Value)) + " - " + ;
					TRCMonth(This.Value, ALLTRIM(ThisForm.cboLanguage.Value))
			
		ENDPROC 
		
		
	PROCEDURE Destroy()
		ThisForm.Release()
		CLEAR EVENTS

	ENDPROC
ENDDEFINE 

**********

FUNCTION TRCDoW()

LPARAMETERS tdDate, tcLanguage

IF PCOUNT() = 2

	LOCAL liLCode as Integer
	LOCAL ARRAY laDays[7, 4]

	laDays[1,1] = "Monday"
	laDays[1,2] = "Lundi"
	laDays[1,3] = "Montag"
	laDays[1,4] = "Meindeg"

	laDays[2,1] = "Tuesday"
	laDays[2,2] = "Mardi"
	laDays[2,3] = "Dienstag"
	laDays[2,4] = "Densdeg"

	laDays[3,1] = "Wednesday"
	laDays[3,2] = "Mercredi"
	laDays[3,3] = "Mittwoch"
	laDays[3,4] = "Mettwoch"

	laDays[4,1] = "Thursday"
	laDays[4,2] = "Jeudi"
	laDays[4,3] = "Donnerstag"
	laDays[4,4] = "Donneschdeg"

	laDays[5,1] = "Friday"
	laDays[5,2] = "Vendredi"
	laDays[5,3] = "Freitag"
	laDays[5,4] = "Freideg"

	laDays[6,1] = "Saturday"
	laDays[6,2] = "Samedi"
	laDays[6,3] = "Samstag"
	laDays[6,4] = "Samsdeg"

	laDays[7,1] = "Sunday"
	laDays[7,2] = "Dimanche"
	laDays[7,3] = "Sonntag"
	laDays[7,4] = "Sonndeg"

	IF TYPE("tdDate") != "D"
		tdDate = DATE()
	ENDIF 

	IF TYPE("tcLanguage") = "C"
		liLCode = ICASE(tcLanguage = "FR", 2, tcLanguage = "DE", 3, tcLanguage = "LU", 4, 1)
	ELSE
		liLCode = 1
	ENDIF 

	RETURN laDays(ASCAN(laDays, CDOW(tdDate), 1, -1, 1, 13), liLCode)

ELSE
	= MESSAGEBOX("Please call developer", 16, "CDoW Translation Routine")
	
	RETURN "Nonsense"

ENDIF

**********

FUNCTION TRCMonth()

LPARAMETERS tdDate, tcLanguage

IF PCOUNT() = 2

	LOCAL liLCode as Integer
	LOCAL ARRAY laMonths[12, 4]

	laMonths[1,1] = "January"
	laMonths[1,2] = "Janvier"
	laMonths[1,3] = "Januar"
	laMonths[1,4] = "Januar"

	laMonths[2,1] = "February"
	laMonths[2,2] = "Février"
	laMonths[2,3] = "Februar"
	laMonths[2,4] = "Februar"

	laMonths[3,1] = "March"
	laMonths[3,2] = "Mars"
	laMonths[3,3] = "März"
	laMonths[3,4] = "März"

	laMonths[4,1] = "April"
	laMonths[4,2] = "Avril"
	laMonths[4,3] = "April"
	laMonths[4,4] = "Abrëll"

	laMonths[5,1] = "May"
	laMonths[5,2] = "Mai"
	laMonths[5,3] = "Mai"
	laMonths[5,4] = "Mee"

	laMonths[6,1] = "June"
	laMonths[6,2] = "Juin"
	laMonths[6,3] = "Juni"
	laMonths[6,4] = "Juni"

	laMonths[7,1] = "July"
	laMonths[7,2] = "Juillet"
	laMonths[7,3] = "Juli"
	laMonths[7,4] = "Juli"

	laMonths[8,1] = "August"
	laMonths[8,2] = "Août"
	laMonths[8,3] = "August"
	laMonths[8,4] = "August"

	laMonths[9,1] = "September"
	laMonths[9,2] = "Septembre"
	laMonths[9,3] = "September"
	laMonths[9,4] = "September"

	laMonths[10,1] = "October"
	laMonths[10,2] = "Octobre"
	laMonths[10,3] = "Oktober"
	laMonths[10,4] = "Oktober"

	laMonths[11,1] = "November"
	laMonths[11,2] = "Novembre"
	laMonths[11,3] = "November"
	laMonths[11,4] = "November"

	laMonths[12,1] = "December"
	laMonths[12,2] = "Décembre"
	laMonths[12,3] = "Dezember"
	laMonths[12,4] = "Dezember"

	IF TYPE("tdDate") != "D"
		tdDate = DATE()
	ENDIF 

	IF TYPE("tcLanguage") = "C"
		liLCode = ICASE(tcLanguage = "FR", 2, tcLanguage = "DE", 3, tcLanguage = "LU", 4, 1)
	ELSE
		liLCode = 1
	ENDIF 

	RETURN laMonths(ASCAN(laMonths, CMonth(tdDate), 1, -1, 1, 13), liLCode)

ELSE
	= MESSAGEBOX("Please call developer", 16, "CMonth Translation Routine")
	
	RETURN "Nonsense"

ENDIF
*********

MarK
 
Use the german resource dll vfp9rdeu.dll and cdow() returns german names.
This only works in the final EXE, in the IDE cdow() uses vfp9.exe as "runtime", which returns English names and terms.





Chriss
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top