Author: ulhume
Date: 2008-08-31 12:48:09 +0200 (Sun, 31 Aug 2008)
New Revision: 1668

Modified:
   
software_suite_v2/software/tuxdroid-gadget-framework/trunk/tuxdroid-gadget-framework/sources/com/kysoh/tuxdroid/gadget/framework/container/Gadget.java
   
software_suite_v2/software/tuxdroid-gadget-framework/trunk/tuxdroid-gadget-framework/sources/com/kysoh/tuxdroid/gadget/framework/container/GadgetDescription.java
   
software_suite_v2/software/tuxdroid-gadget-framework/trunk/tuxdroid-gadget-framework/sources/com/kysoh/tuxdroid/gadget/framework/container/GadgetParameter.java
   
software_suite_v2/software/tuxdroid-gadget-framework/trunk/tuxdroid-gadget-framework/sources/com/kysoh/tuxdroid/gadget/framework/container/GadgetToken.java
Log:
Better translation model

Modified: 
software_suite_v2/software/tuxdroid-gadget-framework/trunk/tuxdroid-gadget-framework/sources/com/kysoh/tuxdroid/gadget/framework/container/Gadget.java
===================================================================
--- 
software_suite_v2/software/tuxdroid-gadget-framework/trunk/tuxdroid-gadget-framework/sources/com/kysoh/tuxdroid/gadget/framework/container/Gadget.java
      2008-08-31 10:47:49 UTC (rev 1667)
+++ 
software_suite_v2/software/tuxdroid-gadget-framework/trunk/tuxdroid-gadget-framework/sources/com/kysoh/tuxdroid/gadget/framework/container/Gadget.java
      2008-08-31 10:48:09 UTC (rev 1668)
@@ -156,9 +156,9 @@
                return helpFile;
        }
 
-       private static I18n i18n;
+       private I18n i18n;
 
-       public static String tr(String message, Object... tmp) {
+       public String tr(String message, Object... tmp) {
                return i18n.tr(message, tmp);
        }
 
@@ -169,6 +169,16 @@
                parameters.add(new GadgetParameter("locutor", "string", 
GadgetsContainer.getLocutor(), "Locutor"));
                parameters.add(new GadgetParameter("country", "string", 
GadgetsContainer.getCountry(), "Country"));
                parameters.add(new GadgetParameter("pitch", "integer", 
GadgetsContainer.getPitch(), "Pitch"));
+               for (GadgetParameter parameter : parameters) {
+                       parameter.setParent(this);
+               }
+               for (GadgetToken token : notifications) {
+                       token.setParent(this);
+               }
+               for (GadgetToken token : commands) {
+                       token.setParent(this);
+               }
+               description.setParent(this);
                i18n = I18nFactory.getI18n(new 
Locale(GadgetsContainer.getLanguage()), new 
File(getInterpreter().getWorkingPath(), "resources"));
                getInterpreter().loaded();
        }

Modified: 
software_suite_v2/software/tuxdroid-gadget-framework/trunk/tuxdroid-gadget-framework/sources/com/kysoh/tuxdroid/gadget/framework/container/GadgetDescription.java
===================================================================
--- 
software_suite_v2/software/tuxdroid-gadget-framework/trunk/tuxdroid-gadget-framework/sources/com/kysoh/tuxdroid/gadget/framework/container/GadgetDescription.java
   2008-08-31 10:47:49 UTC (rev 1667)
+++ 
software_suite_v2/software/tuxdroid-gadget-framework/trunk/tuxdroid-gadget-framework/sources/com/kysoh/tuxdroid/gadget/framework/container/GadgetDescription.java
   2008-08-31 10:48:09 UTC (rev 1668)
@@ -32,8 +32,24 @@
        private String helpFile;
        private String iconFile;
        private UUID uuid;
+       private Gadget parent;
 
        /**
+        * @return the parent
+        */
+       protected Gadget getParent() {
+               return parent;
+       }
+
+       /**
+        * @param parent
+        *            the parent to set
+        */
+       protected void setParent(Gadget parent) {
+               this.parent = parent;
+       }
+
+       /**
         * @return the uuid
         */
        public UUID getUuid() {
@@ -56,6 +72,13 @@
        }
 
        /**
+        * @return the name
+        */
+       public String getTranslatedName() {
+               return parent.tr(name);
+       }
+
+       /**
         * @param name
         *            the name to set
         */
@@ -67,7 +90,7 @@
         * @return the description
         */
        public String getDescription() {
-               return Gadget.tr(description);
+               return getParent().tr(description);
        }
 
        /**

Modified: 
software_suite_v2/software/tuxdroid-gadget-framework/trunk/tuxdroid-gadget-framework/sources/com/kysoh/tuxdroid/gadget/framework/container/GadgetParameter.java
===================================================================
--- 
software_suite_v2/software/tuxdroid-gadget-framework/trunk/tuxdroid-gadget-framework/sources/com/kysoh/tuxdroid/gadget/framework/container/GadgetParameter.java
     2008-08-31 10:47:49 UTC (rev 1667)
+++ 
software_suite_v2/software/tuxdroid-gadget-framework/trunk/tuxdroid-gadget-framework/sources/com/kysoh/tuxdroid/gadget/framework/container/GadgetParameter.java
     2008-08-31 10:48:09 UTC (rev 1668)
@@ -36,8 +36,24 @@
        private Double maxValue = null;
        private String category = null;
        private boolean visible = true;
+       private Gadget parent;
 
        /**
+        * @return the parent
+        */
+       protected Gadget getParent() {
+               return parent;
+       }
+
+       /**
+        * @param parent
+        *            the parent to set
+        */
+       protected void setParent(Gadget parent) {
+               this.parent = parent;
+       }
+
+       /**
         * @return the visible
         */
        public boolean isVisible() {
@@ -121,6 +137,13 @@
        }
 
        /**
+        * @return the name
+        */
+       public String getTranslatedName() {
+               return parent.tr(name);
+       }
+
+       /**
         * @return the kind
         */
        public GadgetParameterType getKind() {
@@ -146,7 +169,7 @@
         * @return the description
         */
        public String getDescription() {
-               return Gadget.tr(description);
+               return parent.tr(description);
        }
 
        /**
@@ -185,7 +208,7 @@
         */
        public String getDefaultValue() {
                if (kind == GadgetParameterType.stringParameter) {
-                       defaultValue = Gadget.tr(defaultValue);
+                       defaultValue = parent.tr(defaultValue);
                }
                return defaultValue;
        }

Modified: 
software_suite_v2/software/tuxdroid-gadget-framework/trunk/tuxdroid-gadget-framework/sources/com/kysoh/tuxdroid/gadget/framework/container/GadgetToken.java
===================================================================
--- 
software_suite_v2/software/tuxdroid-gadget-framework/trunk/tuxdroid-gadget-framework/sources/com/kysoh/tuxdroid/gadget/framework/container/GadgetToken.java
 2008-08-31 10:47:49 UTC (rev 1667)
+++ 
software_suite_v2/software/tuxdroid-gadget-framework/trunk/tuxdroid-gadget-framework/sources/com/kysoh/tuxdroid/gadget/framework/container/GadgetToken.java
 2008-08-31 10:48:09 UTC (rev 1668)
@@ -22,18 +22,37 @@
 
 package com.kysoh.tuxdroid.gadget.framework.container;
 
-
 public class GadgetToken {
        private String name;
        private String description;
+       private Gadget parent;
 
        /**
+        * @return the parent
+        */
+       protected Gadget getParent() {
+               return parent;
+       }
+
+       /**
+        * @param parent
+        *            the parent to set
+        */
+       protected void setParent(Gadget parent) {
+               this.parent = parent;
+       }
+
+       /**
         * @return the name
         */
        public String getName() {
                return name;
        }
 
+       public String getTranslatedName() {
+               return parent.tr(name);
+       }
+
        /**
         * @param name
         *            the name to set
@@ -46,7 +65,7 @@
         * @return the description
         */
        public String getDescription() {
-               return Gadget.tr(description);
+               return parent.tr(description);
        }
 
        /**


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Tux-droid-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tux-droid-svn

Reply via email to