utils: Add flatpak_get_current_locale_subpaths()

This commit is contained in:
Alexander Larsson
2016-06-30 11:41:12 +02:00
parent 9be05bc511
commit 5897ddd7ef
2 changed files with 35 additions and 0 deletions

View File

@@ -3499,3 +3499,36 @@ flatpak_completion_free (FlatpakCompletion *completion)
g_strfreev (completion->original_argv);
g_free (completion);
}
char **
flatpak_get_current_locale_subpaths (void)
{
const gchar * const *langs = g_get_language_names ();
GPtrArray *subpaths = g_ptr_array_new ();
int i;
for (i = 0; langs[i] != NULL; i++)
{
g_autofree char *dir = g_strconcat ("/", langs[i], NULL);
char *c;
c = strchr (dir, '@');
if (c != NULL)
*c = 0;
c = strchr (dir, '_');
if (c != NULL)
*c = 0;
c = strchr (dir, '.');
if (c != NULL)
*c = 0;
if (strcmp (dir, "/C") == 0)
continue;
g_ptr_array_add (subpaths, g_steal_pointer (&dir));
}
g_ptr_array_add (subpaths, NULL);
return (char **)g_ptr_array_free (subpaths, FALSE);
}

View File

@@ -46,6 +46,8 @@ const char ** flatpak_get_arches (void);
const char * flatpak_get_bwrap (void);
char ** flatpak_get_current_locale_subpaths (void);
void flatpak_migrate_from_xdg_app (void);
GBytes * flatpak_read_stream (GInputStream *in,