Index: lams_flex/LamsAuthor/src/assets/languages/dictionary.xml
===================================================================
RCS file: /usr/local/cvsroot/lams_flex/LamsAuthor/src/assets/languages/dictionary.xml,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ lams_flex/LamsAuthor/src/assets/languages/dictionary.xml 28 Jan 2010 03:48:06 -0000 1.1
@@ -0,0 +1,7 @@
+
+
+
+ XXXXXXXXXXXXXXXXXXXX
+
+
+
\ No newline at end of file
Index: lams_flex/LamsAuthor/src/org/lamsfoundation/lams/author/controller/AuthorController.as
===================================================================
RCS file: /usr/local/cvsroot/lams_flex/LamsAuthor/src/org/lamsfoundation/lams/author/controller/AuthorController.as,v
diff -u -r1.6 -r1.7
--- lams_flex/LamsAuthor/src/org/lamsfoundation/lams/author/controller/AuthorController.as 28 Jan 2010 03:03:42 -0000 1.6
+++ lams_flex/LamsAuthor/src/org/lamsfoundation/lams/author/controller/AuthorController.as 28 Jan 2010 03:48:06 -0000 1.7
@@ -20,10 +20,9 @@
public class AuthorController
{
- public function AuthorController()
- {
- }
+ private var dictionaryFallback:XML;
+ public function AuthorController(){}
/**
* Sets the learningLibrary object on startup.
@@ -54,8 +53,13 @@
}
+
+ public function setDictionaryFallback(xml:XML):void {
+ dictionaryFallback = new XML(xml);
+ }
+
public function setDictionary(xml:XML):void {
- Application.application.dictionary = new XMLDictionaryRegistry(xml);
+ Application.application.dictionary = new XMLDictionaryRegistry(xml, dictionaryFallback);
}
/**
Index: lams_flex/LamsAuthor/src/org/lamsfoundation/lams/author/maps/MainEventMap.mxml
===================================================================
RCS file: /usr/local/cvsroot/lams_flex/LamsAuthor/src/org/lamsfoundation/lams/author/maps/MainEventMap.mxml,v
diff -u -r1.4 -r1.5
--- lams_flex/LamsAuthor/src/org/lamsfoundation/lams/author/maps/MainEventMap.mxml 28 Jan 2010 03:03:42 -0000 1.4
+++ lams_flex/LamsAuthor/src/org/lamsfoundation/lams/author/maps/MainEventMap.mxml 28 Jan 2010 03:48:06 -0000 1.5
@@ -24,6 +24,9 @@
[Bindable]
private var dictionaryUrl:String;
+ [Bindable]
+ private var dictionaryFallbackUrl:String;
+
public function init():void {
if (Application.application.TESTING) {
@@ -39,6 +42,7 @@
}
}
+ dictionaryFallbackUrl = "assets/languages/dictionary.xml";
dictionaryUrl = "assets/languages/" + Application.application.locale + ".xml";
}
@@ -77,6 +81,13 @@
+
+
+
+
+
+
+
@@ -102,6 +113,7 @@
+
Index: lams_flex/LamsFlexCommon/src/org/lamsfoundation/lams/common/dictionary/XMLDictionary.as
===================================================================
RCS file: /usr/local/cvsroot/lams_flex/LamsFlexCommon/src/org/lamsfoundation/lams/common/dictionary/XMLDictionary.as,v
diff -u -r1.1 -r1.2
--- lams_flex/LamsFlexCommon/src/org/lamsfoundation/lams/common/dictionary/XMLDictionary.as 12 Jan 2010 01:14:34 -0000 1.1
+++ lams_flex/LamsFlexCommon/src/org/lamsfoundation/lams/common/dictionary/XMLDictionary.as 28 Jan 2010 03:48:07 -0000 1.2
@@ -6,12 +6,16 @@
{
private var eventDispatcher:EventDispatcher;
private var dictionaryXML:XML;
+ private var fallbackXML:XML;
- public function XMLDictionary(xml:XML)
+
+ public function XMLDictionary(xml:XML, fallbackXMLIn:XML = null)
{
eventDispatcher = new EventDispatcher();
dictionaryXML = new XML(xml);
+ fallbackXML = new XML(fallbackXMLIn);
+
eventDispatcher.dispatchEvent(new XMLDictionaryEvent(XMLDictionaryEvent.COMPLETE));
}
@@ -25,11 +29,27 @@
}
public function getLabel(s:String):String{
- if(!isEmpty()){
+ /* if(!isEmpty()){
return dictionaryXML.language.entry.(@key==s).name;
}
- return null;
+ return null; */
+
+ if(!isEmpty()) {
+ var value:String = dictionaryXML.language.entry.(@key==s).name;
+
+ // If we dont get a value, default to fallback
+ if ((value == null || value == "") && fallbackXML != null && fallbackXML.toString() != ""){
+ value = fallbackXML.language.entry.(@key==s).name;
+ }
+
+ // If a label has been found, return it, otherwise print an error string
+ if (!(value == null || value == "")) {
+ return value;
+ }
+ }
+
+ return "??" + s + "??";
}
public function getLabelAndConcatenate(s:String, a:Array):String{
Index: lams_flex/LamsFlexCommon/src/org/lamsfoundation/lams/common/dictionary/XMLDictionaryRegistry.as
===================================================================
RCS file: /usr/local/cvsroot/lams_flex/LamsFlexCommon/src/org/lamsfoundation/lams/common/dictionary/XMLDictionaryRegistry.as,v
diff -u -r1.2 -r1.3
--- lams_flex/LamsFlexCommon/src/org/lamsfoundation/lams/common/dictionary/XMLDictionaryRegistry.as 28 Jan 2010 03:03:42 -0000 1.2
+++ lams_flex/LamsFlexCommon/src/org/lamsfoundation/lams/common/dictionary/XMLDictionaryRegistry.as 28 Jan 2010 03:48:07 -0000 1.3
@@ -12,14 +12,17 @@
private var _xmlDictionary:XMLDictionary;
private var keyRegistry:Array;
+ private var fallbackXML:XML;
- public function XMLDictionaryRegistry(value:XML)
+ public function XMLDictionaryRegistry(value:XML, fallbackXMLIn:XML=null)
{
+ fallbackXML = fallbackXMLIn;
xml = value;
+
}
public function set xml(value:XML):void {
- _xmlDictionary = new XMLDictionary(value);
+ _xmlDictionary = new XMLDictionary(value, fallbackXML);
this.dispatchEvent(new Event("updatedLabels"));
this.dispatchEvent(new Event("updatedLabelsReplace"));