Logo

Docs

  • HOME

Source: i18n/I18nDico.js

/**
 *
 * Copyright (C) 2021 Akorbi Digital RMP
 *
 * This file is part of RunMyProcess SDK-JS.
 *
 * RunMyProcess SDK-JS is free software: you can redistribute it and/or modify
 * it under the terms of the Apache License Version 2.0 (the "License");
 *
 *   You may not use this file except in compliance with the License.
 *   You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *   Unless required by applicable law or agreed to in writing, software
 *   distributed under the License is distributed on an "AS IS" BASIS,
 *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *   See the License for the specific language governing permissions and
 *   limitations under the License.
 */
  /**
  Create a new instance of I18nDico
  	@constructor
	@property {String} dicoJson - json object containing the language entries
	@property {String} language - The language of the dico
	@property {String} name - The name of the dico
	@see I18n
	@see Resource
	@example Load Dico from app
		function loadI18n(p_app){
			var i18n = p_app.i18n;
            i18n.load({
				onSuccess:function(){
					var dico = i18n.dicos[0];
					dico.load({
						onSuccess:function(){
							alert("Dico "+dico.name+" loaded!");
						}
					});				
				}
			});
		};
	@example Load designer Dico from process
		function loadi18n(p){
            var i18n = p.i18n;
            i18n.load({
				onSuccess:function(){
					i18n.loadDesignerDico({
						onSuccess:function(){
							alert(JSON.stringify(i18n.designerDico));
						}			   
					});				
				}
			});
		};
 */
function I18nDico(){
	this.dicoJson = {};
	this.language;
	this.name;
};
 /**
	@borrows
	Inherits Resource
 */
I18nDico.prototype = new  Resource();
/**
	Overrides Resource's loadPreset method.
	@method
	@see Resource#loadPreset
*/
I18nDico.prototypeloadPreset = function () {
	/**
		Overrides Resource's generateUrl method to return the request url
		@method
		@see Resource#generateUrl
	*/
	this.generateUrl = function () {
		return this.selfUrl;
	};
};
/**
	Override Resource load method.
	@method
	@param {object} options - options to be used during the call<br/>
	@param {Resource~onSuccess} options.onSuccess - a callback function called in case of a success
	@param {Resource~onFailure} [options.onFailure] - a callback function called in case of a failure
	@param {String} [options.baseUrl] - base URL. If not set the current base URL will be used
	@see Resource#load
 */
I18nDico.prototype.load = function(options){
	var father = this;
	var optAjax = {};
	optAjax.onSuccess = function(rObject){
		father.dicoJson = rObject;
		options.onSuccess(rObject);
	};
	optAjax.onFailure = function(e){
		options.eObject=e;
		father.errorManager(options);
	};
	optAjax.baseUrl = options.baseUrl || RMPApplication.getBaseUrl();
	father.ajaxLoad(optAjax);
};
/**
	Update override.
	@method
	@param {object} options - options to be used during the call<br/>
	@param {Resource~onSuccess} options.onSuccess - a callback function called in case of a success
	@param {Resource~onFailure} [options.onFailure] - a callback function called in case of a failure
	@param {String} [options.baseUrl] - base URL. If not set the current base URL will be used
	@see Resource#update
	@example Update Library
		function loadI18n(p_app){
			var i18n = p_app.i18n;
			var opti18n = {};
			opti18n.onSuccess =  function(){
				var library = i18n.languages[0];
				var optLib = {};
				optLib.onSuccess = function(){
					library.dicoJson.widget.id_name.text="New Name";//Change JSON values
					optUp = {};
					optUp.onSuccess=function(){
					   alert("Lib updated!");
					};
					optUp.onFailure=function(e){
					   alert("Lib NOT updated! "+JSON.stringify(e));
					};
					library.update(optUp);
				};
				library.load(optLib);
			};
			i18n.load(opti18n);
		};
*/
I18nDico.prototype.update = function (options) {
	var father = this;
/**
	Overrides Resource's updatePreset method.
	@method
	@see Resource#updatePreset
*/
	father.updatePreset = function () {
		/**
			Overrides Resource's generateUrl method to return the url of the current loaded library
			@method
			@see Resource#generateUrl
		*/
		father.generateUrl = function () {
			return father.selfUrl;
		};
		father.contentType = 'json';//expect json data
		father.xml = JSON.stringify(father.dicoJson);
	};
	father.resourceUpdate(options);//Update Library
};

Index

Classes

  • AccessLog
  • AllLaneUserList
  • AppInstanceReport
  • Context
  • Customer
  • CustomerDomainList
  • CustomerList
  • CustomerSubscriptionList
  • CustomerTrafficList
  • CustomList
  • CustomListList
  • Domain
  • Host
  • HostList
  • HostMode
  • I18n
  • I18nDico
  • Lane
  • LaneList
  • LanePoolList
  • LogLog
  • Metadata
  • Oauth
  • OauthList
  • Pool
  • PoolList
  • Preferences
  • Process
  • ProcessList
  • Project
  • ProjectAppliQuery
  • ProjectChildList
  • ProjectLaneList
  • ProjectList
  • ProjectProcess
  • ProjectProcessList
  • ProjectProcessQuery
  • ProjectVersion
  • ProjectVersionList
  • Report
  • RequestLog
  • Resource
  • SavedQuery
  • Subscription
  • Token
  • Traffic
  • Usage
  • User
  • UserAccessList
  • UserDelegation
  • UserDelegationList
  • UserLaneList
  • UserList
  • UserRepresentationList
  • UserSupportAuth
  • UserSupportAuthList
  • WebInterface
  • WebInterfaceList

Global

  • context

© Akorbi Digital RMP. All Rights Reserved - Legal terms - Contact