Monday, November 08, 2010 at 12:04 AM.


on getLanguageTableAddress (pta = nil) {
	<<4/9/00; 10:31:25 PM by JES
	<<Returns the address of the language table corresponding to the language specified in the page table.
		<<If the page table specifies languageTableAddress, return that address
		<<If the page table does not specify languageTableAddress, return the address to the table corresponding to the language in the page table
		<<If the page table does not specify a language or if there's no translation table for the specified language, return the default address, the address of the English language table
	if pta == nil {
		pta = html.getPageTableAddress ()};
	if defined (pta^.languageTableAddress) { // return the address specified in the page table -- optimization
		return (pta^.languageTableAddress)};
	if defined (pta^.language) { // if the page table specifies a language, return the address for the language
		if defined (mainResponder.localization.languages.[pta^.language]) {
			pta^.languageTableAddress = (@mainResponder.localization.languages.[pta^.language]);
			return (pta^.languageTableAddress)}};
	if defined (config.mainResponder.globals.language) { // does the server have a default setting?
		if defined (mainResponder.localization.languages.[config.mainResponder.globals.language]) {
			pta^.languageTableAddress = (@mainResponder.localization.languages.[config.mainResponder.globals.language]);
			return (@mainResponder.localization.languages.[config.mainResponder.globals.language])}};
	pta^.languageTableAddress = @mainResponder.localization.languages.english;
	return (@mainResponder.localization.languages.english)}; // couldn't find the language table -- default to English

<<bundle // debugging code
	<<mainResponder.localization.getLanguageTableAddress ()

This listing is for code that runs in the OPML Editor environment. I created these listings because I wanted the search engines to index it, so that when I want to look up something in my codebase I don't have to use the much slower search functionality in my object database. Dave Winer.