user-directory-i18n

===================================================================

Gbp-Pq: Name user-directory-i18n.patch
This commit is contained in:
Debian GNOME Maintainers 2022-06-29 16:02:18 +08:00 committed by luzp
parent 228612b3a5
commit e48d4d720e
2 changed files with 2639 additions and 1838 deletions

View File

@ -118,6 +118,9 @@ static GHashTable *gid_cache = NULL;
#endif /* !G_OS_WIN32 */ #endif /* !G_OS_WIN32 */
char* update_xdg_directory_display_name (const char *path,
char *display_name);
char * char *
_g_local_file_info_create_etag (GLocalFileStat *statbuf) _g_local_file_info_create_etag (GLocalFileStat *statbuf)
{ {
@ -1629,6 +1632,7 @@ _g_local_file_info_get_nostat (GFileInfo *info,
G_FILE_ATTRIBUTE_ID_STANDARD_DISPLAY_NAME)) G_FILE_ATTRIBUTE_ID_STANDARD_DISPLAY_NAME))
{ {
char *display_name = g_filename_display_basename (path); char *display_name = g_filename_display_basename (path);
char *xdg_display_name = NULL;
/* look for U+FFFD REPLACEMENT CHARACTER */ /* look for U+FFFD REPLACEMENT CHARACTER */
if (strstr (display_name, "\357\277\275") != NULL) if (strstr (display_name, "\357\277\275") != NULL)
@ -1637,7 +1641,9 @@ _g_local_file_info_get_nostat (GFileInfo *info,
display_name = g_strconcat (display_name, _(" (invalid encoding)"), NULL); display_name = g_strconcat (display_name, _(" (invalid encoding)"), NULL);
g_free (p); g_free (p);
} }
g_file_info_set_display_name (info, display_name); xdg_display_name = update_xdg_directory_display_name (path, display_name);
g_file_info_set_display_name (info, xdg_display_name);
g_free (xdg_display_name);
g_free (display_name); g_free (display_name);
} }
@ -1717,6 +1723,31 @@ get_icon_name (const char *path,
return name; return name;
} }
char *update_xdg_directory_display_name (const char *path,
char *display_name)
{
char *retval = g_strdup (display_name);
if (g_strcmp0 (path, g_get_user_special_dir (G_USER_DIRECTORY_DESKTOP)) == 0)
{
retval = g_strdup (_("Desktop"));
} else if (g_strcmp0 (path, g_get_user_special_dir (G_USER_DIRECTORY_DOCUMENTS)) == 0) {
retval = g_strdup (_("Documents"));
} else if (g_strcmp0 (path, g_get_user_special_dir (G_USER_DIRECTORY_DOWNLOAD)) == 0) {
retval = g_strdup (_("Download"));
} else if (g_strcmp0 (path, g_get_user_special_dir (G_USER_DIRECTORY_MUSIC)) == 0) {
retval = g_strdup (_("Music"));
} else if (g_strcmp0 (path, g_get_user_special_dir (G_USER_DIRECTORY_PICTURES)) == 0) {
retval = g_strdup (_("Pictures"));
} else if (g_strcmp0 (path, g_get_user_special_dir (G_USER_DIRECTORY_PUBLIC_SHARE)) == 0) {
retval = g_strdup (_("Public Share"));
} else if (g_strcmp0 (path, g_get_user_special_dir (G_USER_DIRECTORY_TEMPLATES)) == 0) {
retval = g_strdup (_("Templates"));
} else if (g_strcmp0 (path, g_get_user_special_dir (G_USER_DIRECTORY_VIDEOS)) == 0) {
retval = g_strdup (_("Videos"));
}
return retval;
}
static GIcon * static GIcon *
get_icon (const char *path, get_icon (const char *path,
const char *content_type, const char *content_type,

File diff suppressed because it is too large Load Diff