Author Topic: Multi-language structure for language independant scripts  (Read 5688 times)

Benjamin Dasari

  • GuiXT Forum
  • Newbie
  • *
  • Posts: 95
    • View Profile
Multi-language structure for language independant scripts
« on: September 27, 2019, 01:38:21 PM »
Purpose:
Maintain a structure to easily implement new languages for existing scripts when working with language independent scripts.

NOTE::
 - Make sure the configuration file guixt.sjs has the below line:
      nolanguagekey = true;
 - Also, the screen files should not have any language key, example below:
      SAPMV45A.0101.sjs

Liquid UI Code:
----------------------------------------------------------------------------------------------------------------------------------------------
Script File Name: SESSION.sjs       // Session file
----------------------------------------------------------------------------------------------------------------------------------------------
switch(_language) {
   case 'E':
      load('languageEN.sjs');
      logonLanguage = languageEN;
      break;
   case 'F':
      load('languageFR.sjs');
      logonLanguage = languageFR;
      break;
   case 'S':
      load('languageES.sjs');
      logonLanguage = languageES;
      break;   
   default:
      logonLanguage = languageEN;
      break;
}

----------------------------------------------------------------------------------------------------------------------------------------------
Script File Name: SAPMV45A.4001.sjs       // VA02 transaction
----------------------------------------------------------------------------------------------------------------------------------------------
// User Interface
if(_page.exists(logonLanguage.pageexists.sales)){
   del(logonLanguage.controls.itemoverview);
   del(logonLanguage.controls.itemdetails);
   del(logonLanguage.controls.ordparty);
   del(logonLanguage.controls.procurement);
   del(logonLanguage.controls.shipping);
   del(logonLanguage.controls.reasonforrej);
   del(logonLanguage.controls.listofsalesorders);
   
   text(logonLanguage.controls.sales, logonLanguage.texts.salesdata);
   
   text([0,89], logonLanguage.texts.headertxt,{ "size":20});
   textbox([1,89], [4,125], {"name":"z_va02_hdrtxt", "textfont":"Arial", "textheight":"12", "textweight":"5"});
   
   columnheader("SAPMV45A_TCTRL_U_ERF_AUFTRAG,2", logonLanguage.texts.matlnum);         //Material column
   inputfield( [4,0], logonLanguage.inputfield.delstatus, [4,17], {"name":"z_va02_delstatus", "size":22});
   
   pushbutton([TOOLBAR], logonLanguage.pushbutton.exit, '/nVA02');
   pushbutton([TOOLBAR], logonLanguage.pushbutton.gotoeasyaccess, '/n', {"group":"A+"});
   
   message("W: "+logonLanguage.message.msgponum);
}

----------------------------------------------------------------------------------------------------------------------------------------------
Script File Name: languageEN.sjs       // English language file
----------------------------------------------------------------------------------------------------------------------------------------------
var languageEN = {
   "inputfield": {   
      "delstatus": "Delivery Status"
   },
   "pushbutton": {      
      "exit": "Exit",                                    
      "gotoeasyaccess": "Goto SAP Easy Access"
   },
   "texts": {      
      "salesdata": "Sales Data",
      "headertxt": "Header Text",
      "matlnum": "Material Number"
   },
   "message": {      
      "msgponum": "Enter PO number"
   },
   "controls": {
      "sales": "P[Sales]",                                 
      "itemoverview": "P[Item overview]",                                 
      "itemdetails": "P[Item detail]",                                    
      "ordparty": "P[Ordering party]",                                    
      "procurement": "P[Procurement]",                  
      "shipping": "P[Shipping]",
      "reasonforrej": "P[Reason for rejection]",
      "listofsalesorders": "P[list of sales orders]"
   },
   "pageexists": {
      "sales": "Sales"
   }
};

----------------------------------------------------------------------------------------------------------------------------------------------
Script File Name: languageES.sjs       // Spanish language file
----------------------------------------------------------------------------------------------------------------------------------------------
var languageES = {
   "inputfield": {   
      "delstatus": "Status entrega"
   },
   "pushbutton": {      
      "exit": "Salida",                                    
      "gotoeasyaccess": "Ir a SAP Easy Access"
   },
   "texts": {      
      "salesdata": "Los datos de ventas",
      "headertxt": "Texto de cabecera",
      "matlnum": "Número material"
   },
   "message": {      
      "msgponum": "Ingrese el número de pedido"
   },
   "controls": {
      "sales": "P[Ventas]",                                 
      "itemoverview": "P[Resumen de posiciones]",                                 
      "itemdetails": "P[Detalle posición]",                                    
      "ordparty": "P[Solicitante]",                                    
      "procurement": "P[Aprovisionamiento]",                  
      "shipping": "P[Expedición]",
      "reasonforrej": "P[Motivo de rechazo]",
      "listofsalesorders": "P[Lista de pedidos]"
   },
   "pageexists": {
      "sales": "Ventas"
   }
};

----------------------------------------------------------------------------------------------------------------------------------------------
Script File Name: languageFR.sjs       // French language file
----------------------------------------------------------------------------------------------------------------------------------------------
var languageFR = {
   "inputfield": {   
      "delstatus": "Statut livr."
   },
   "pushbutton": {      
      "exit": "Sortie",                                    
      "gotoeasyaccess": "Aller à SAP Easy Access"
   },
   "texts": {      
      "salesdata": "Données de vente",
      "headertxt": "En-tête",
      "matlnum": "Numéro d'article"
   },
   "message": {      
      "msgponum": "Entrez le numéro de bon de commande"
   },
   "controls": {
      "sales": "P[Vente]",                                 
      "itemoverview": "P[Synthèse des postes]",                                 
      "itemdetails": "P[Détail du poste]",                                    
      "ordparty": "P[Acheteur]",                                    
      "procurement": "P[Approvisionnement]",                  
      "shipping": "P[Expédition]",
      "reasonforrej": "P[Motif d'annulation]",
      "listofsalesorders": "P[Liste des commandes client]"
   },
   "pageexists": {
      "sales": "Vente"
   }
};


See attachments for code samples!
[/list]
« Last Edit: October 02, 2019, 02:59:25 PM by Benjamin Dasari »