[glom] Export to .po files: Make sure we export static text items.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glom] Export to .po files: Make sure we export static text items.
- Date: Sun, 11 Nov 2012 20:02:15 +0000 (UTC)
commit bf946d5fddc62a2686879765cc638e025da026ad
Author: Murray Cumming <murrayc murrayc com>
Date: Sun Nov 11 21:02:08 2012 +0100
Export to .po files: Make sure we export static text items.
* glom/libglom/document/document.cc: fill_translatable_layout_items():
Add the member text (a translatable item) of LayoutItem_Text items.
Also add LayoutItem_Images items, which may have titles.
* tests/test_document_load_translations.cc: Check that a LayoutItem_Text
is present.
* glom/glom_document.dtd: Improve this for these items.
ChangeLog | 24 ++++++++++++++++++++++++
glom/glom_document.dtd | 16 +++++++++-------
glom/libglom/document/document.cc | 17 ++++++++++++++---
tests/test_document_load_translations.cc | 3 +++
4 files changed, 50 insertions(+), 10 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index e154413..a33f269 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,29 @@
2012-11-11 Murray Cumming <murrayc murrayc com>
+ Export to .po files: Make sure we export static text items.
+
+ * glom/libglom/document/document.cc: fill_translatable_layout_items():
+ Add the member text (a translatable item) of LayoutItem_Text items.
+ Also add LayoutItem_Images items, which may have titles.
+ * tests/test_document_load_translations.cc: Check that a LayoutItem_Text
+ is present.
+ * glom/glom_document.dtd: Improve this for these items.
+
+2012-11-11 Murray Cumming <murrayc murrayc com>
+
+ Need a short description (OOPS!).
+ Need the bug URL (OOPS!).
+
+ Reviewed by NOBODY (OOPS!).
+
+ Additional information of the change such as approach, rationale. Please add per-function descriptions below (OOPS!).
+
+ * glom/glom_document.dtd:
+ * glom/libglom/document/document.cc:
+ * tests/test_document_load_translations.cc:
+
+2012-11-11 Murray Cumming <murrayc murrayc com>
+
Tests: Add pixbuf-loading tests in more places.
* tests/test_document_load_image.cc:
diff --git a/glom/glom_document.dtd b/glom/glom_document.dtd
index 9c6ae7e..7963026 100644
--- a/glom/glom_document.dtd
+++ b/glom/glom_document.dtd
@@ -248,11 +248,18 @@ TODO: Should we specify the presence of child text nodes in the ELEMENT somehow?
columns_count CDATA #IMPLIED
border_width CDATA #IMPLIED>
-<!-- data_layout_text displays static text (text that is not from the database). -->
- <!ELEMENT data_layout_text (text?, formatting?, position?)>
+<!-- data_layout_text displays static text (text that is not from the database).
+ It may have a title, which may be translated. -->
+ <!ELEMENT data_layout_text (trans_set?, text?, formatting?, position?)>
<!ATTLIST data_layout_text
+ title CDATA #IMPLIED
sequence CDATA #IMPLIED>
+<!-- The text tag contains the text of a data_layout_text, and its translations. TODO: Add the translations. -->
+ <!ELEMENT text (trans_set?)>
+ <!ATTLIST text
+ title CDATA #REQUIRED>
+
<!-- data_layout_image displays a static image (an image that is not from the database).
The text attribute is the base64-encoded image data (if format="base64". Otherwise it is the deprecated GDA image text format.) -->
<!ELEMENT data_layout_image (formatting?, position?)>
@@ -261,11 +268,6 @@ TODO: Should we specify the presence of child text nodes in the ELEMENT somehow?
title CDATA #IMPLIED
sequence CDATA #IMPLIED>
-<!-- The text tag contains the text of a data_layout_text, and its translations. TODO: Add the translations. -->
- <!ELEMENT text EMPTY>
- <!ATTLIST text
- title CDATA #REQUIRED>
-
<!-- sortby describes what a data_layout_item_groupby sorts by. -->
<!ELEMENT sortby (data_layout_item*)>
diff --git a/glom/libglom/document/document.cc b/glom/libglom/document/document.cc
index 122633f..e450212 100644
--- a/glom/libglom/document/document.cc
+++ b/glom/libglom/document/document.cc
@@ -4437,13 +4437,24 @@ void Document::fill_translatable_layout_items(const sharedptr<LayoutGroup>& grou
{
sharedptr<LayoutItem_Text> text = sharedptr<LayoutItem_Text>::cast_dynamic(item);
if(text)
+ {
the_list.push_back( pair_translatable_item_and_hint(text, this_hint) );
+ if(text->m_text)
+ the_list.push_back( pair_translatable_item_and_hint(text->m_text, this_hint) );
+ }
else
{
- sharedptr<LayoutItem_Field> layout_field = sharedptr<LayoutItem_Field>::cast_dynamic(item);
- if(layout_field)
+ //Images have titles:
+ sharedptr<LayoutItem_Image> image = sharedptr<LayoutItem_Image>::cast_dynamic(item);
+ if(image)
+ the_list.push_back( pair_translatable_item_and_hint(image, this_hint) );
+ else
{
- fill_translatable_layout_items(layout_field, the_list, hint);
+ sharedptr<LayoutItem_Field> layout_field = sharedptr<LayoutItem_Field>::cast_dynamic(item);
+ if(layout_field)
+ {
+ fill_translatable_layout_items(layout_field, the_list, hint);
+ }
}
}
}
diff --git a/tests/test_document_load_translations.cc b/tests/test_document_load_translations.cc
index 17c54e0..c12d564 100644
--- a/tests/test_document_load_translations.cc
+++ b/tests/test_document_load_translations.cc
@@ -337,6 +337,9 @@ int main()
const bool contains_customtitle =
contains_item_type<Glom::CustomTitle>(list_layout_items);
g_assert( contains_customtitle );
+ const bool contains_static_text =
+ contains_item_type<Glom::LayoutItem_Text>(list_layout_items);
+ g_assert( contains_static_text );
const bool contains_report =
contains_item_type<Glom::Report>(list_layout_items);
g_assert( contains_report );
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]