1 /* 2 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab 3 * Copyright (C) 2009 - DIGITEO - Sylvestre LEDRU 4 * 5 * Copyright (C) 2012 - 2016 - Scilab Enterprises 6 * 7 * This file is hereby licensed under the terms of the GNU GPL v2.0, 8 * pursuant to article 5.3.4 of the CeCILL v.2.1. 9 * This file was originally licensed under the terms of the CeCILL v2.1, 10 * and continues to be available under such terms. 11 * For more information, see the COPYING file which you should have received 12 * along with this program. 13 * 14 */ 15 /* Messages.i */ 16 /** 17 * Windows: swig -java -package org.scilab.modules.localization -outdir ../java/org/scilab/modules/localization/ Messages.i 18 * Others: Use the option --enable-build-swig to the configure 19 */ 20 %module Messages 21 22 %{ 23 #include "scilabDefaults.h" 24 #include "localizationJava.h" 25 %} 26 27 28 /* JavaDoc for MessagesJNI class */ 29 %pragma(java) jniclassclassmodifiers=%{ 30 31 /* It is generated code. Disable checkstyle */ 32 //CHECKSTYLE:OFF 33 /** 34 * @author Sylvestre LEDRU 35 * @copyright DIGITEO 2009 36 */ 37 public class%} 38 39 /* Constructor for MessagesJNI class */ 40 %pragma(java) jniclasscode=" 41 /** 42 * Constructor 43 */ 44 protected MessagesJNI() { 45 throw new UnsupportedOperationException(); 46 }"; 47 48 /* static load of library */ 49 %pragma(java) jniclasscode=%{ 50 static { 51 try { 52 if (System.getProperty("os.name").toLowerCase().contains("windows") != true) { 53 if (System.getProperty("testngTests")!=null) { 54 System.loadLibrary("scilab"); 55 } 56 } 57 System.loadLibrary("scilocalization"); catch(SecurityException e)58 } catch (SecurityException e) { 59 System.err.println("A security manager exists and does not allow the loading of the specified dynamic library."); 60 System.err.println(e.getLocalizedMessage()); 61 e.printStackTrace(System.err); 62 } catch (UnsatisfiedLinkError e) { 63 System.err.println("The native library scilocalization does not exist or cannot be found."); 64 System.err.println(e.getLocalizedMessage()); 65 e.printStackTrace(System.err); 66 } 67 } 68 %} 69 70 /* JavaDoc for Messages class */ 71 %pragma(java) moduleclassmodifiers=" 72 /** 73 * @author Sylvestre Ledru 74 * @copyright DIGITEO 2008 75 */ 76 public class"; 77 78 /* Constructor for Messages class */ 79 %pragma(java) modulecode=" 80 /** 81 * Constructor 82 */ 83 protected Messages() { 84 throw new UnsupportedOperationException(); 85 }"; 86 87 /* JavaDoc */ 88 %javamethodmodifiers gettext(char *key) " 89 /** 90 * Translate a message 91 * @param[in] string the key of the message (usually the english msg) 92 * @return The localized string 93 */ 94 public"; 95 96 /* Thanks to rename, gettext is the Java method and in the native code, 97 we are calling the C function scigettext */ 98 %rename(gettext) scigettext; 99 char *scigettext(char *key); 100 101 %rename(dgettext) scidgettext; 102 char *scidgettext(char *domain, char *key); 103