Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Here is a way to translate menus on the fly
Message
From
10/02/2005 01:02:44
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Menus & Menu designer
Title:
Here is a way to translate menus on the fly
Miscellaneous
Thread ID:
00985444
Message ID:
00985444
Views:
62
This works well. For ease of reading, you can make menu prompts to be something like [Save As] (with the brackets).
PROCEDURE LocalizeMenu
LPARAMETERS tcMprFile,tcLanguage
	LOCAL lcMPR
	lcMPR = FILETOSTR(FORCEEXT(tcMprFile,'MPR'))
	IF EMPTY(lcMPR)
		RETURN
	ENDIF
        * Localize.dbf holds translations.  It has an index field (Tag), and a memo field for each language.
	SELECT Localize
	SCAN FOR UPPER(LEFT(Tag,5)) = 'MENU_'
		lcFrom = UPPER(ALLTRIM(SUBSTR(Tag,6)))
		lcTo   = EVALUATE(ALLTRIM(tcLanguage))
		lnStartPos = AT(lcFrom,UPPER(lcMPR))
		IF lnStartPos > 0
			lcMPR = STUFF(lcMPR,lnStartPos,LEN(lcFrom),lcTo)
		ENDIF
	ENDSCAN
	lcNewMenu = FORCEEXT(FORCEPATH(SYS(2015),SYS(2023)),'MPR')
	STRTOFILE(lcMPR,lcNewMenu)
	COMPILE (lcNewMenu)
	lcCompiledMenu = FORCEEXT(lcNewMenu,'MPX')
	DO (lcCompiledMenu)
Reply
Map
View

Click here to load this message in the networking platform