[java-libglom] Fix the build with the latest libglom from git master.



commit a9f591debc0ff4b76fe50232f1d08c382ce82a76
Author: Murray Cumming <murrayc murrayc com>
Date:   Mon Jan 16 12:43:01 2012 +0100

    Fix the build with the latest libglom from git master.
    
    * src/glom.i:
    * src/examples/org/glom/libglom/examples/ExampleDocumentLoad.java
    * src/test/java/org/glom/libglom/tests/DocumentTest.java:
    TranslatableItem::get_title() and get_title_or_name() now take a locale string.

 ChangeLog                                          |    9 +++++++
 .../glom/libglom/examples/ExampleDocumentLoad.java |    8 ++++--
 src/glom.i                                         |   26 ++++++++++----------
 .../java/org/glom/libglom/tests/DocumentTest.java  |   19 +++++++-------
 4 files changed, 36 insertions(+), 26 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 4c81f0f..091a5de 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2012-01-16  Murray Cumming  <murrayc murrayc com>
+
+  Fix the build with the latest libglom from git master.
+
+	* src/glom.i:
+	* src/examples/org/glom/libglom/examples/ExampleDocumentLoad.java
+	* src/test/java/org/glom/libglom/tests/DocumentTest.java: 
+	TranslatableItem::get_title() and get_title_or_name() now take a locale string.
+
 2012-01-10  Murray Cumming  <murrayc murrayc com>
 
 	Fix the build with the latest libglom 1.21.
diff --git a/src/examples/org/glom/libglom/examples/ExampleDocumentLoad.java b/src/examples/org/glom/libglom/examples/ExampleDocumentLoad.java
index 961ce10..6d98175 100644
--- a/src/examples/org/glom/libglom/examples/ExampleDocumentLoad.java
+++ b/src/examples/org/glom/libglom/examples/ExampleDocumentLoad.java
@@ -35,6 +35,8 @@ import org.glom.libglom.StringVector;
 
 public class ExampleDocumentLoad {
 
+  private static String locale = ""; //This means the original locale.
+
 	private static void printLayoutGroup(LayoutGroup layoutGroup, String indent) {
 		if (layoutGroup == null)
 			return;
@@ -47,7 +49,7 @@ public class ExampleDocumentLoad {
 			if (layoutItem == null)
 				continue;
 
-			System.out.print(indent + "Layout Item: title=" + layoutItem.get_title_or_name() + ", item type="
+			System.out.print(indent + "Layout Item: title=" + layoutItem.get_title_or_name(locale) + ", item type="
 					+ layoutItem.get_part_type_name());
 
 			String displayName = layoutItem.get_layout_display_name();
@@ -72,7 +74,7 @@ public class ExampleDocumentLoad {
 			if (layoutGroup == null)
 				continue;
 
-			System.out.println("    Layout Group: title=" + layoutGroup.get_title_or_name());
+			System.out.println("    Layout Group: title=" + layoutGroup.get_title_or_name(locale));
 			printLayoutGroup(layoutGroup, "      ");
 		}
 	}
@@ -149,7 +151,7 @@ public class ExampleDocumentLoad {
 					continue;
 				}
 
-				System.out.println("  Field: name=" + field.get_name() + ", title=" + field.get_title_or_name()
+				System.out.println("  Field: name=" + field.get_name() + ", title=" + field.get_title_or_name(locale)
 						+ ", type=" + Field.get_type_name_ui(field.get_glom_type()));
 
 			}
diff --git a/src/glom.i b/src/glom.i
index 893b714..91adaeb 100644
--- a/src/glom.i
+++ b/src/glom.i
@@ -633,20 +633,20 @@ Glib::ustring get_table_used(const Glib::ustring& parent_table)
 
 /** Get the title of the relationship that is actually used,
  * falling back to the relationship's name.
- * @param parent_table_title The title of table to which the item (or its relatinoships) belong.
+ * @param parent_table_title The title of table to which the item (or its relationships) belong.
  */
-Glib::ustring get_title_used(const Glib::ustring& parent_table_title)
+Glib::ustring get_title_used(const Glib::ustring& parent_table_title, const Glib::ustring& locale)
 {
-  return self->get_title_used(parent_table_title);
+  return self->get_title_used(parent_table_title, locale);
 }
 
 /** Get the singular title of the relationship that is actually used,
  * falling back to the regular (plural) title, and then to the relationship's name.
- * @param parent_table_title The title of table to which the item (or its relatinoships) belong.
+ * @param parent_table_title The title of table to which the item (or its relationships) belong.
  */
-Glib::ustring get_title_singular_used(const Glib::ustring& parent_table_title)
+Glib::ustring get_title_singular_used(const Glib::ustring& parent_table_title, const Glib::ustring& locale)
 {
-  return self->get_title_singular_used(parent_table_title);
+  return self->get_title_singular_used(parent_table_title, locale);
 }
 
 Glib::ustring get_to_field_used()
@@ -755,20 +755,20 @@ Glib::ustring get_table_used(const Glib::ustring& parent_table)
 
 /** Get the title of the relationship that is actually used,
  * falling back to the relationship's name.
- * @param parent_table_title The title of table to which the item (or its relatinoships) belong.
+ * @param parent_table_title The title of table to which the item (or its relationships) belong.
  */
-Glib::ustring get_title_used(const Glib::ustring& parent_table_title)
+Glib::ustring get_title_used(const Glib::ustring& parent_table_title, const Glib::ustring& locale)
 {
-  return self->get_title_used(parent_table_title);
+  return self->get_title_used(parent_table_title, locale);
 }
 
 /** Get the singular title of the relationship that is actually used,
  * falling back to the regular (plural) title, and then to the relationship's name.
- * @param parent_table_title The title of table to which the item (or its relatinoships) belong.
+ * @param parent_table_title The title of table to which the item (or its relationships) belong.
  */
-Glib::ustring get_title_singular_used(const Glib::ustring& parent_table_title)
+Glib::ustring get_title_singular_used(const Glib::ustring& parent_table_title, const Glib::ustring& locale)
 {
-  return self->get_title_singular_used(parent_table_title);
+  return self->get_title_singular_used(parent_table_title, locale);
 }
 
 Glib::ustring get_to_field_used()
@@ -802,7 +802,7 @@ Glib::ustring get_sql_join_alias_name()
 }
 
 /** Get the item's alias name, if it uses a relationship, or just get its table name.
- * @param parent_table The table to which the item (or its relatinoships) belong.
+ * @param parent_table The table to which the item (or its relationships) belong.
  */
 Glib::ustring get_sql_table_or_join_alias_name(const Glib::ustring& parent_table)
 {
diff --git a/src/test/java/org/glom/libglom/tests/DocumentTest.java b/src/test/java/org/glom/libglom/tests/DocumentTest.java
index 61c30ad..28a45f5 100644
--- a/src/test/java/org/glom/libglom/tests/DocumentTest.java
+++ b/src/test/java/org/glom/libglom/tests/DocumentTest.java
@@ -47,12 +47,11 @@ import org.junit.Test;
 
 /**
  * Simple test to ensure that the generated bindings are working.
- * 
- * @author Murray Cumming, Ben Konrath
  */
 public class DocumentTest {
 
 	private static Document document;
+	private static String locale = ""; //This means the original locale.
 
 	@BeforeClass
 	static public void setUp() {
@@ -95,10 +94,10 @@ public class DocumentTest {
 		assertEquals(6, fields.size());
 
 		Field field = fields.get(0);
-		String titles = field.get_title_or_name();
+		String titles = field.get_title_or_name(locale);
 		for (int i = 1; i < fields.size(); i++) {
 			field = fields.get(i);
-			titles += ", " + field.get_title_or_name();
+			titles += ", " + field.get_title_or_name(locale);
 		}
 		assertThat(titles, is("Album ID, Comments, Name, Artist ID, Publisher ID, Year"));
 
@@ -106,10 +105,10 @@ public class DocumentTest {
 		assertEquals(4, fields.size());
 
 		field = fields.get(0);
-		titles = field.get_title_or_name();
+		titles = field.get_title_or_name(locale);
 		for (int i = 1; i < fields.size(); i++) {
 			field = fields.get(i);
-			titles += ", " + field.get_title_or_name();
+			titles += ", " + field.get_title_or_name(locale);
 		}
 		assertThat(titles, is("Artist ID, Description, Comments, Name"));
 
@@ -117,10 +116,10 @@ public class DocumentTest {
 		assertEquals(3, fields.size());
 
 		field = fields.get(0);
-		titles = field.get_title_or_name();
+		titles = field.get_title_or_name(locale);
 		for (int i = 1; i < fields.size(); i++) {
 			field = fields.get(i);
-			titles += ", " + field.get_title_or_name();
+			titles += ", " + field.get_title_or_name(locale);
 		}
 		assertThat(titles, is("Publisher ID, Comments, Name"));
 
@@ -128,10 +127,10 @@ public class DocumentTest {
 		assertEquals(4, fields.size());
 
 		field = fields.get(0);
-		titles = field.get_title_or_name();
+		titles = field.get_title_or_name(locale);
 		for (int i = 1; i < fields.size(); i++) {
 			field = fields.get(i);
-			titles += ", " + field.get_title_or_name();
+			titles += ", " + field.get_title_or_name(locale);
 		}
 		assertThat(titles, is("Song ID, Comments, Album ID, Name"));
 	}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]