Modified constructors for MTranslator. Also committed a forgotten file.
authorMarco Zanon <info@marcozanon.com>
Sat, 22 Jul 2017 07:53:45 +0000 (07:53 +0000)
committerMarco Zanon <info@marcozanon.com>
Sat, 22 Jul 2017 07:53:45 +0000 (07:53 +0000)
src/java/com/marcozanon/macaco/MConstants.java [new file with mode: 0644]
src/java/com/marcozanon/macaco/text/MTranslator.java

diff --git a/src/java/com/marcozanon/macaco/MConstants.java b/src/java/com/marcozanon/macaco/MConstants.java
new file mode 100644 (file)
index 0000000..a2aec61
--- /dev/null
@@ -0,0 +1,16 @@
+/**
+ * Macaco
+ * Copyright (c) 2009-2017 Marco Zanon <info@marcozanon.com>.
+ * Released under MIT license (see LICENSE for details).
+ */
+
+package com.marcozanon.macaco;
+
+
+public class MConstants extends MObject {
+
+    public static final String MACACO_VERSION = "6.x";
+
+    public static final String TEXT_ENCODING = "UTF-8";
+
+}
index cdddd3b52a26271bd49101b58d39b2085dbdc551..8ff5c695077487e6fe8d64b3a6034bdd46d638fa 100644 (file)
@@ -20,40 +20,26 @@ import java.util.Locale;
 
 public class MTranslator extends MObject {
 
-    protected String file = null;
     protected Locale basicLocale = null;
 
     protected LinkedHashMap<String, LinkedHashMap<String, String>> messages = new LinkedHashMap<String, LinkedHashMap<String, String>>();
 
     /* */
 
-    public MTranslator(String file, Locale basicLocale) throws MTranslationFileParsingException {
+    public MTranslator(Locale basicLocale) {
         super();
         //
         if (null == basicLocale) {
             throw new IllegalArgumentException("Invalid 'basicLocale': null.");
         }
         //
-        this.file = file;
         this.basicLocale = basicLocale;
-        //
-        this.parseFile(this.getFile());
-    }
-
-    public MTranslator clone() {
-        MTranslator tmpMTranslator = null;
-        try {
-            tmpMTranslator = new MTranslator(this.getFile(), this.getBasicLocale());
-        }
-        catch (MTranslationFileParsingException exception) { // should not happen
-        }
-        return tmpMTranslator;
     }
 
-    /* File. */
-
-    protected String getFile() {
-        return this.file;
+    public MTranslator(Locale basicLocale, String file) throws MTranslationFileParsingException {
+        this(basicLocale);
+        //
+        this.parseFile(file);
     }
 
     /* Locale. */