Sha256: 48a347bf8c7313ba7ea7596587602a6af8a2ef84a577cd41d48fff0c9c6952d9

Contents?: true

Size: 972 Bytes

Versions: 8

Compression:

Stored size: 972 Bytes

Contents

function htmlEncode(text) {
	if (!text)
		return '' ;
	text = text.replace(/&/g, '&');
	text = text.replace(/</g, '&lt;');
	text = text.replace(/>/g, '&gt;');
	return text ;
}
function translateTag(tag, propertyToSet, encode) {
	var tags = document.getElementsByTagName(tag) ;
	var sKey, s ;
	for (var i = 0 ; i < tags.length ; i++ ) {
		if ((sKey = tags[i].getAttribute( 'fmLang' ))) {
			if ((s = FMLang[sKey]) && s.length > 0)	{
				if (encode) {
					s = htmlEncode(s);
				}
				tags[i][ propertyToSet ] = s ;
			 	
			}
		}
	}
}
function translatePage() {
	translateTag('INPUT', 'value');
	translateTag('SPAN', 'innerHTML');
	translateTag('LABEL', 'innerHTML');
	translateTag('OPTION', 'innerHTML', true);
	translateTag('LEGEND', 'innerHTML');
}

function getText(key, defaultValue) {
	if (!FMLang[key]) {
		if (!defaultValue) {
			return key;
		} else {
			return defaultValue;
		}
	} else {
		return FMLang[key];
	}
}

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
typo-5.5 public/filemanager/javascripts/translate.js
filemanager-0.1.1 rails/public/filemanager/javascripts/translate.js
filemanager-0.2.0 filemanager/public/filemanager/javascripts/translate.js
filemanager-0.2.1 filemanager/public/filemanager/javascripts/translate.js
filemanager-0.1.0 rails/public/filemanager/javascripts/translate.js
filemanager-0.3.0 filemanager/public/filemanager/javascripts/translate.js
filemanager-0.3.1 filemanager/public/filemanager/javascripts/translate.js
filemanager-0.2.2 filemanager/public/filemanager/javascripts/translate.js