diff options
author | Wu Xiaotian <[email protected]> | 2019-11-25 16:32:46 +0800 |
---|---|---|
committer | raveit65 <[email protected]> | 2019-12-01 11:39:44 +0100 |
commit | f939df14afd1474d5d0c05d5552fee3af2d481e8 (patch) | |
tree | 8f1e3059ecb9f4faca713ae4c837d54f820408b7 /plugins | |
parent | e4bd57fac54005ed7cdcc859989b88bfc3934448 (diff) | |
download | pluma-f939df14afd1474d5d0c05d5552fee3af2d481e8.tar.bz2 pluma-f939df14afd1474d5d0c05d5552fee3af2d481e8.tar.xz |
Taglist: Load the local translation string from lang.mo file
When using intltool, the taglist creates a big xml file containing the
local translation string, so that it has to be compressed.
It looks like this:
```
<TagGroup sort="true" name="XHTML 1.0 - Tags">
<Tag name="Abbreviated form">
...
</Tag>
<Tag name="...">
...
</Tag>
...
</TagGroup>
<TagGroup xml:lang="af" sort="true" name="XHTML 1.0 - Tags">
<Tag name="Afgekorte vorm" xml:lang="af">
...
</Tag>
<Tag name="..." xml:lang="af">
...
</Tag>
...
</TagGroup>
<TagGroup xml:lang="..." sort="true" name="XHTML 1.0 - Tags">
</TagGroup>
```
Obviously, it wastes space and download bandwidth.
When switch from intltool to gettext, it does not generate a similar
huge xml file. It only get the translate string into pot file from the
xml file, and the original xml file has not changed.
This patch let taglist-plugin read the local translation string directly
from the mo file, so that it can work as before.
TODO: we need to improve and optimize the taglist plugin code and
drop some extra code.
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/taglist/pluma-taglist-plugin-parser.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/plugins/taglist/pluma-taglist-plugin-parser.c b/plugins/taglist/pluma-taglist-plugin-parser.c index 6f18dbc5..10e9e9ca 100644 --- a/plugins/taglist/pluma-taglist-plugin-parser.c +++ b/plugins/taglist/pluma-taglist-plugin-parser.c @@ -139,7 +139,7 @@ parse_tag_group (TagGroup *tg, const gchar* fn, xmlDocPtr doc, tag = g_new0 (Tag, 1); /* Get Tag name */ - tag->name = xmlGetProp (cur, (const xmlChar *) "name"); + tag->name = (xmlChar*)gettext((const char*)xmlGetProp (cur, (const xmlChar *) "name")); if (tag->name == NULL) { @@ -195,7 +195,7 @@ get_tag_group (const gchar* filename, xmlDocPtr doc, tag_group = g_new0 (TagGroup, 1); /* Get TagGroup name */ - tag_group->name = xmlGetProp (cur, (const xmlChar *) "name"); + tag_group->name = (xmlChar*)gettext((const char*)xmlGetProp (cur, (const xmlChar *) "name")); sort_str = xmlGetProp (cur, (const xmlChar *) "sort"); |