libxmlb icon indicating copy to clipboard operation
libxmlb copied to clipboard

XbBuilder could work without explicit xb_builder_add_locale() calls

Open mwleeds opened this issue 5 years ago • 1 comments

Currently one must call xb_builder_add_locale() on an XbBuilder object to add system locales before using xb_builder_compile(), at least if one is using XB_BUILDER_COMPILE_FLAG_SINGLE_LANG. @pwithnall proposed an alternative way for it to work here:

Seems a bit odd that most instances of XbBuilder have to have this loop called on them, using the results of g_get_language_names(), before they will work properly. Looking at the implementation, it basically checks any node which has an xml:lang attribute set. If the attribute value is not in the set of locales, that node is ignored. Seems like it would be faster and more convenient to have an XbBuilder:use-system-locales property, which tells XbBuilder to check for set inclusion against g_get_language_names() internally. Then you don’t need to set it up, or copy a list of strings.

mwleeds avatar Jan 21 '20 18:01 mwleeds

use-system-locales works for me.

hughsie avatar Jan 21 '20 22:01 hughsie