if( typeof( AdmeaDossier ) == 'undefined' ) AdmeaDossier = {};

AdmeaDossier.Locale = function() {
	return {
		/* Global */
		Yes: 'Yes',
		No: 'No',
		Cancel: 'Cancel',
		
		/* DossierLayout */
		LoginWindowTitle: 'Please log in...',
		
		LoginUserName: 'E-Mail',
		LoginPassword: 'Password',
		LoginCancel: 'Cancel',
		LoginAction: 'Log in!',
		LoginRememberMe: 'Remember my username',
	
		LoginWaitTitle: 'Authenticating...',
		LoginWaitMessage: 'Validating data',

		ContentPanelMaximize: 'Maximize this window',
		ContentPanelRestore: 'Restore window to previous size',
	
		/* Session */
		SessionAnonymous: 'Anonymous',
		SessionLoginFailedTitle: 'Login failed',
		
		SessionConfirmLogoutTitle: 'Confirm logout...',
		SessionConfirmLogoutMessage: 'Are you sure you want to log out now? You will lose all unsaved changes!',
		
		SessionRequestPassword: 'Forgot your password? click here...',
		SessionPasswordResetResponseTitle: 'Request password reset',
		SessionMissingUsername: 'Please enter your e-mail address...',
		
		SessionResetCookies: 'If you recently used the old interface; click here to reset your cookies',

		/* Statusbar */
		StatusbarNotLoggedIn: 'You are not logged in...',
		StatusbarLoggedInAs: 'Logged in as: ',
		
		StatusbarChangePassword: 'Change my password...',
		
		/* Node Management */
		NodeManagementUpdating: 'Updating...',
		NodeManagementConfirmDeleteTitle: 'Confirm delete',
		NodeManagementConfirmDelete: 'You are about to delete "{name}".<br />This will permanently delete the selected node and all subnodes.<br />Are you sure?',
		
		NodeManagementError: 'Oops the action did not work out too well!',
		NodeManagementFailed: 'An error occured while trying to {action} the node:<br />({code}) {message}',
		
		NodeManagementActionTitle: 'Save Changes?',
		NodeManagementAction: 'You are about to make changes to the tree. Do you want to move or copy the node "{target}" from "{oldparent}" to "{newparent}"?',
		
		NodeManagementActionCopy: 'Copy',
		NodeManagementActionMove: 'Move',
		
		NodeManagementAccessRights: 'Configure access rights',
		NodeManagementToggleVisible: 'Visible',
		NodeManagementStylesLoading: 'Style (Loading)',
		NodeManagementStyles: 'Style',
		NodeManagementAddObject: 'Add a new object',
		NodeManagementCreateSubnode: 'Create new subnode',
		NodeManagementDeleteNode: 'Delete this node',
		NodeManagementRenameNode: 'Rename this node',
		
		
		/* Repro / EMail List */
		ReproWindowTitle: 'Repro and EMail list',
		
		
		/* Admin interface */
		Manager: {
			Management: 'Management',

			Refresh: 'Refresh',
			
			TreeTitle: 'Mapping',
			Dossier: 'Dossier',
			Objects: 'Objects',
			Database: 'Database',
			Settings: 'Settings',
			Users: 'Users',
			
			MenuActions: 'Modify',
			MenuActionsSelectNodeWarning: 'Please select a node first',
			MenuActionsSelectNodeWarningTitle: 'Unable to comply',
			
			Pages: {
				StylesTitle: 'Styles',
				StylesDesc: 'Edit the look and feel of the pages',
				
				StatsTitle: 'Statistics',
				StatsDesc: 'View the visitor statistics',
				
				ObjectsTitle: 'Linked Objects',
				ObjectsDesc: 'View all objects currently used in the site',
				
				EditorTitle: 'Approve Objects',
				EditorDesc: 'View all objects waiting for approval',
				
				TrashTitle: 'Unlinked Objects',
				TrashDesc: 'View all unused objects',
				
				TablesTitle: 'Tables',
				TablesDesc: 'View all table definitions',
				
				DataTitle: 'Data',
				DataDesc: 'View and modify data in the tables',
				
				SettingsTitle: 'Settings',
				SettingsDesc: 'Select a database and manage your password',
				
				AdminTitle: 'Administration',
				AdminDesc: 'Manage global settings',
				
				UsersTitle: 'Users',
				UsersDesc: 'Manage all site users',
				
				EFormsTitle: 'E-Forms',
				EFormsDesc: 'Settings for E-Forms',

				ExplorerTitle: 'Explorer',
				ExplorerDesc: 'Manage your files on the webserver',
				
				EFormsDisabledWarningTitle: 'EForms are disabled for this dossier',
				EFormsDisabledWarningMessage: 'Sorry, EForms are disabled for this dossier'

			} // Pages
		}	// Manager
	};
}();




/* Allow formatting of language strings */

if(!String.prototype.format)
	String.prototype.format = function()
	{
		var param = arguments.length === 1 && typeof(arguments[0]) == "object" ? arguments[0] : arguments;
		var i = -1, result = "";
		for(var s; (s = this.indexOf("{", i)) !== -1;)
		{
			result += this.slice(i+1, s);

			if(this[s+1] === "{"){
				i = s + 2;
				result += "{";
				continue;
			}

			var i = this.indexOf("}", s + 1);

			if(i === -1)
				throw "incorrect format: {0}".format(this);
				
			result += param[this.slice(s + 1, i)];
		}

		return result + this.slice(i+1);
	}

if(!String.format)
	String.format = function(str){
		return String.prototype.format.apply(str, Array.prototype.slice.call(arguments, 1));
	}
