﻿/*************************************************************************************************************
messages.js

localized javascript messages

how to use:
===========
include this script firts in the page:
	<!-- localized javascript messages. instanciate a window level object ibpMsg-->
	&lt;script language="JavaScript" type="text/javascript"
		src="../Static/Include/ML/messages.js"&gt;&lt;/script&gt;
for any translated version include the locale specific file:
	<!-- localized javascript messages.-->
	&lt;script language="JavaScript" type="text/javascript"
		src="../Static/Include/ML/messagesLoc_<lang>.js"&gt;&lt;/script&gt;
	where lang is the current locale string representation.

* this file is the default one and needs to be included no matter what the locale is
additional specific files will override its entries values

the script will create an object named ibpMsg (or window.ibpMsg)
there is only one method:
	ibpMsg.get(key);
	example: alert(ibpMsg.get("my message key"));

*************************************************************************************************************/

//enMsg construstor function
function enMsgConstrustor()
{
	/*
	get localized text
	
	params:
		key - key to get
		replaceText - text to replace in key value:
			may be a single string - replaced with ~1~
			may be a 1 D array - replaced with ~<i+1>~
			may be a 2 D array - holds replace key and value
	*/
	var get=function(key, replaceText)
	{
		var msg=msgs[key];
		//handle replacemenets
		if(!ibpUtils.isEmpty(replaceText))
		{
			//not an array?
			if(!ibpUtils.isArray(replaceText))
			{
				msg=msg.replace("~1~", replaceText);
			}
			//array
			else
			{
				for(i=0;i<replaceText.length;i++)
				{
					//1 D array?
					if(!ibpUtils.isArray(replaceText[i]))
						msg=msg.replace("~"+(i+1)+"~", replaceText[i]);
					//2 D array
					else if(replaceText[i].length>1)
						msg=msg.replace(replaceText[i][0], replaceText[i][1]);
				}
			}
		}
		return msg;
	}
	this.get=get;

	//set localized text
	var set=function(key,val)
	{
		msgs[key]=val;
	}
	this.set=set;

	//messages repository
	var msgs=
	{
		/************** local specific messages **************************************
		the following mwssages need to be translated for all languages
		in the separate files
		each message is structured:
		["]message name[" : "]message content["] [, in all lines except the last]
		*****************************************************************************/
		
		//hierarchic Menu
		"ibpMenu.treeCreate" : "Hierarchical Menu Trees Created",
		"ibpMenu.createMenu" : "Creating Hierarchical Menus:",
		"ibpMenu.createFavsFailed" : "Failed to create the \'Favorites\' sub menu",
		"ibpMenu.createMenuFailed" : "Failed to create the Menu. Please refresh the page to try again",

		//ibpRequired
		"ibpUtils.confirmDelete" : "Are you sure you want to delete this item?",
		"ibpUtils.confirmDeleteItem" : "Are you sure you want to delete item \'~1~\'?",

		//general
		"general.continue" : "Continue?",
		"general.confirmPurgeArchive" : "Are you sure you want to purge all archived items?",
		"general.confirmPurgeObjArchive" : "Are you sure you want to purge archived versions?",
		"general.confirmUnsubscribe" : "Are you sure you want to unsubscribe?",
		"general.confirmDelForumRec" : "This forum and any sub forums would be deleted.\\nAre you sure you want to proceed?",
		"general.confirmDelFAQRec" : "This category and any sub category would be deleted.\\nAre you sure you want to proceed?",
		"general.confirmDelFilter" : "Are you sure you want to remove your custom filter?",

		"general.confirmCascadeDelRole" : "Are you sure you want to delete this role and all its child roles?",
		"general.confirmCascadeDelZone" : "Are you sure you want to delete this zone and all its child zones?",
		"general.confirmCascadeDelClass" : "Are you sure you want to delete this class and all its child classes?",
		"general.restoreDefaults" : "Changes will be applied only after clicking \'Save\'",
		"general.fckEditorUnavailable" : "Warning: FCK Editor javascript library might have failed to load. please make sure fckeditor.js is linked in this page",

		"general.action.delete" : "Delete",
		"general.advanced" : "Advanced",

		//ibpValidation
		"ibpValidation.inTheField" : " in the \'~1~\' field",
		"ibpValidation.enterNum" : "Please enter a number",
		"ibpValidation.enterValueGreater" : "Please enter a value with greater than or equal to",
		"ibpValidation.enterValueLess" : "Please enter a value less than or equal to",
		"ibpValidation.enterValBetween" : "Please enter a value between ~1~ and ~2~",
		"ibpValidation.enterNoOfCharsGreater" : "Please enter a value with no of characters greater than or equal to",
		"ibpValidation.enterNoOfCharsLess" : "Please enter a value with no of characters less than or equal to",
		"ibpValidation.enterNoOfCharsBetween" : "Please enter a value with no of characters between ~1~ and ~2~",
		"ibpValidation.noOfChars" : "(no of characters is:~1~)",
		"ibpValidation.enterDollar" : "Please enter a dollar amount",
		"ibpValidation.enterInteger" : "Please enter an integer",
		"ibpValidation.enterDate" : "Please enter a date as \'",
		"ibpValidation.enterPattern" : "Please enter a valid pattern",
		"ibpValidation.enterPhone" : "Please enter a valid phone number",
		"ibpValidation.enterEmail" : "Please enter a valid email address",
		"ibpValidation.enterEmails" : "Please enter a valid emails address",
		"ibpValidation.enterZip" : "Please enter a valid ZIP code",
		"ibpValidation.enterSystemName" : "Please enter a valid System name (Starts with a letter, has no spaces or special characters)",
		"ibpValidation.enterValue" : "Please enter a value",
		"ibpValidation.allowedFileTypes" : "Please enter a file of type: \'~1~\'",
		"ibpValidation.forbiddenFileTypes" : "Please enter a file not of type: \'~1~\'",
		"ibpValidation.allowedValues" : "Please enter values in: \'~1~\'",
		"ibpValidation.forbiddenValues" : "Please enter values not in: \'~1~\'",
		"ibpValidation.equalVals" : "The value in \'~1~\' should be the same as the value",
		"ibpValidation.notEqualVals" : "The value in \'~1~\' should be different than the value",

		//ibpUtils
		"ibpUtils.currProccess" : "Currently processing request...",
		"ibpUtils.truncatedText" : "field content will be truncated.\\nmax characters allowed",
		"ibpUtils.noItems" : "No items are selected",
		"ibpUtils.reProccess" : "\\nRe-process anyway?",
		"ibpUtils.delSomeItem" : "Are you sure you want to ~1~ this item ?",
		"ibpUtils.delItem" : "Are you sure you want to ~1~ item ~2~ ?",

		//ibpApp
		"ibpApp.noCell" : "There is no cell that directoin",
		"ibpApp.promptFavsTitle" : "Please Suggest a Title:",
		"ibpApp.requiredValue" : "Field requires a value.",
		"ibpApp.progressBarDefTitle" : "Processing ...",
		"ibpApp.maximize" : "Maximize",
		"ibpApp.minimize" : "Minimize",
		"ibpApp.restore" : "Restore",
		"ibpApp.collapse" : "Collapse",
		"ibpApp.expand" : "Expand",
		"ibpApp.alertNotLoginAndClose" : "User is not logged in. Please login again.",
		"ibpApp.askIfProceed" : "You have already made changes on that page \\n proceed and discard these changes?",
		"ibpApp.confirmRefresh" : "Reload interval has elapsed. reload page now?",
		"ibpApp.confirmHideCell" : "Hide this cell?\\nyou will be able to make it visible from \'preferences content\' tab",
		"ibpApp.cell.save" : "Save",
		"ibpApp.cell.cancel" : "Cancel",
		"ibpApp.cell.print" : "Print...",
		"ibpApp.cell.send" : "Send...",
		"ibpApp.cell.reload" : "Reload",
		"ibpApp.cell.preferences" : "Preferences...",
		"ibpApp.qbe.noclass" : "Must specify a class for the builder.",
		//enCalendar
		"enCalendar.days.1" : "Su",
		"enCalendar.days.2" : "Mo",
		"enCalendar.days.3" : "Tu",
		"enCalendar.days.4" : "We",
		"enCalendar.days.5" : "Th",
		"enCalendar.days.6" : "Fr",
		"enCalendar.days.7" : "Sa",

		"enCalendar.months.1" : "January",
		"enCalendar.months.2" : "February",
		"enCalendar.months.3" : "March",
		"enCalendar.months.4" : "April",
		"enCalendar.months.5" : "May",
		"enCalendar.months.6" : "June",
		"enCalendar.months.7" : "July",
		"enCalendar.months.8" : "August",
		"enCalendar.months.9" : "September",
		"enCalendar.months.10" : "October",
		"enCalendar.months.11" : "November",
		"enCalendar.months.12" : "December",

		"enCalendar.time" : "Time (24h)",
		"enCalendar.save" : "Save",
		"enCalendar.am" : "AM",
		"enCalendar.pm" : "PM",
﻿		"" : ""
	};
}//end of construstor function

//instanciate object
if(!window.ibpMsg)window.ibpMsg=new enMsgConstrustor();
