mirror of
https://github.com/flatpak/flatpak.git
synced 2026-04-13 03:18:47 -04:00
utils: Add flatpak_get_current_locale_subpaths()
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user