"Desktop" is not localized in live mode

Bug #1306866 reported by shijing on 2014-04-12
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Ubuntu Kylin
Low
ShuiLu Pi
Ubuntu Translations
Medium
Unassigned
casper (Ubuntu)
Medium
Unassigned

Bug Description

进入live 模式实用,Desktop没有翻译。见附件。

Please see the attached image, all standard folders like Public, Download are localized, but Desktop is not.

shijing (shijing) wrote :
Ubuntu QA Website (ubuntuqa) wrote :

This bug has been reported on the Ubuntu ISO testing tracker.

A list of all reports related to this bug can be found here:
http://iso.qa.ubuntu.com/qatracker/reports/bugs/1306866

tags: added: iso-testing
tags: added: utopic-pre-alpha1
Changed in ubuntukylin:
importance: Undecided → Medium
tags: added: l10n
Changed in ubuntukylin:
milestone: none → vivid-alpha1
Jack Yu (jackyu) on 2014-10-30
Changed in ubuntukylin:
assignee: nobody → lenky0401 (lenky0401)
lenky0401 (lenky0401) wrote :

查到如下几点:
1,问题确认存在,在live模式下,主目录的桌面显示为英文“Desktop”,安装后,显示为中文“桌面”。

2,直接原因来之主目录配置文件:~/.config/user-dirs.dirs,在live模式下,桌面的条目对应为:
XDG_DESKTOP_DIR="$HOME/Desktop"
而安装后,桌面的条目对应为:
XDG_DESKTOP_DIR="$HOME/桌面"

3,查了xdg-user-dirs-gtk-0.10的源码,问题应该不在xdg-user-dirs-gtk-0.10内。

4,问题在创建默认账号的lightdm程序里?需要进一步深入排查。

lenky0401 (lenky0401) wrote :

进入live模式后,通过执行两步:
1,先转为英文
export LANG=en_US.UTF-8
xdg-user-dirs-gtk-update

2,再转为中文
export LANG=zh_CN.UTF-8
xdg-user-dirs-gtk-update

发现Desktop转为中文了
另外,查看代码后,也没有发现有针对live模式的特别逻辑,上面实验也可以看到在live模式,转英文再转中文是可以把“Desktop”转为“桌面”的,因此问题不在xdg-user-dirs-gtk-update这些转换程序的翻译上。比较可能的情况是进入live模式的过程中,有其他进程进行的特定判断而导致

Jack Yu (jackyu) wrote :

这个问题应该在Ubuntu版本中也存在。@shijing, 确认不?

Changed in ubuntukylin:
status: New → Confirmed
Jack Yu (jackyu) wrote :

请lenky继续分析,定位后再找上游沟通。

shijing (shijing) wrote :

@lenky 测试Ubuntu 1504 dailybuild 存在此问题。

lenky0401 (lenky0401) wrote :

通过光盘启动后,进入安装界面,此时按ctrl+alt+f1进入到字符界面,可以看到桌面文件夹Desktop已经创建了,这时是英文的,即便当前的环境变量LANG为zh_CN.UTF-8。

在安装界面,如果点击试用而进入到试用状态,在这个进入的过程中会调用xdg-user-dirs-update创建个人目录:桌面,公共的,图片,音乐,模板,……,等。

通过分析xdg-user-dirs-update的源代码,发现它里面有个后续兼容目录backwards_compat_dirs的判断,当已经存在Desktop目录时,就会跳过翻译:

   /* New default dir. Check if its an old named dir. We want to
      reuse that if it exists. */
   compat_dir = lookup_backwards_compat (default_dir);
   if (compat_dir)
     {
       path_name = concat_strings (get_home_dir (), "/", compat_dir->path, NULL);
       if (!is_directory (path_name))
  {
    free (path_name);
    path_name = NULL;
  }
       else
  relative_path_name = strdup (compat_dir->path);
     }
 }

      if (path_name == NULL)
 {
   translated_name = localize_path_name (default_dir->path);
   relative_path_name = filename_from_utf8 (translated_name);
   if (relative_path_name == NULL)

也就是上面代码中,compat_dir为真,!is_directory()为假,导致path_name为真,从而后续的localize_path_name()的翻译就没调到,因此这个bug就来了。

在安装好系统后,新建用户,然后以新建用户登录系统,此时因为没有提前存在Desktop目录,所以就能够直接创建出新的被localize_path_name()的“桌面”。

lenky0401 (lenky0401) wrote :

不知道是哪个进程创建了这个Desktop目录,如果能找到这个进程对应的程序,对它进行_()翻译应该就可以解决。

但这样做估计有风险,担心中文路径会影响后续其他安装线程的运行?特别是如果有程序直接硬编码的访问Desktop目录就麻烦了。因为从代码来看,这里是刻意做的后向兼容处理,建议暂不做修改?

lenky0401 (lenky0401) wrote :

通过分析iso镜像里的/casper/initrd.lz,解压后,找到创建用户的代码在scripts/casper-bottom/25adduser脚本里,里面有命令行直接写了Desktop,没有做翻译。

前后连起来,就是这个bug的来由。

要解决,需要对casper做国际化。

Changed in casper (Ubuntu):
assignee: nobody → lenky0401 (lenky0401)
summary: - 进入live 模式实用,Desktop没有翻译。
+ "Desktop" is not localized in live mode
description: updated
Anthony Wong (anthonywong) wrote :

idea 1: retrieve the translation from casper script, and replace every instance of "Desktop" to the translated string.

idea 2: at an appropriate moment, executes `xdg-user-dirs-update --force`

Dimitri John Ledkov (xnox) wrote :

The problem is that casper creates Desktop to add "Install Ubuntu" desktop icon by default I believe.
However, I do agree that translated names should be created on the fly much later after user chooses a new language and language packs are available. Can we make casper add an upstart user session job to force recreate xdg-user dirs at each live user login time?

jiaowen520li (jiaowen520li) wrote :

原本命名为Desktop的图片,名称已变更为“桌面”;但界面中多了一个名为“Desktop”的文件夹。
测试使用的系统:UbuntuKylin 14.10 Daily-1214 amd64
测试使用的机器:笔记本 HP-Pavilion-Sleekbook-15-PC
测试使用的安装方式:物理机安装

Changed in ubuntukylin:
milestone: vivid-alpha1 → vivid-alpha2
Changed in ubuntukylin:
milestone: vivid-alpha2 → vivid-beta1
lenky0401 (lenky0401) wrote :

一时半会搞不定。这个是改成wishlist吧?

Jack Yu (jackyu) on 2015-02-04
Changed in ubuntukylin:
milestone: vivid-beta1 → vivid-beta2
jiaowen520li (jiaowen520li) wrote :

This bug still exists in UK15.04-0311-Daily-amd64.

Aron Xu (happyaron) on 2015-03-23
Changed in ubuntukylin:
milestone: vivid-beta2 → none
importance: Medium → High
jiaowen520li (jiaowen520li) wrote :

This bug still exists in UK15.04-0408-Daily-amd64&i386.

jiaowen520li (jiaowen520li) wrote :

This bug still exists in UK15.10-0614-Daily-amd64&i386.

Changed in ubuntukylin:
milestone: none → wily-alpha1
tags: added: wily-alpha1
jiaowen520li (jiaowen520li) wrote :

This bug still exists in UK15.10-0622-Daily-amd64&i386.

jiaowen520li (jiaowen520li) wrote :

This bug still exists in UK15.10-0714-Daily-amd64&i386.

jiaowen520li (jiaowen520li) wrote :

This bug still exists in UK15.10-0726-Daily-amd64&i386.

jiaowen520li (jiaowen520li) wrote :

This bug still exists in UK15.10-0730-Daily-amd64&i386.

Changed in ubuntukylin:
milestone: wily-alpha1 → wily-beta1
jiaowen520li (jiaowen520li) wrote :

This bug still exists in UK14.04.3-0806-Daily-amd64&i386.

jiaowen520li (jiaowen520li) wrote :

This bug still exists in UK15.10-0823-Daily-amd64&i386.

jiaowen520li (jiaowen520li) wrote :

This bug still exists in UK15.10-0916-Daily-amd64&i386.

jiaowen520li (jiaowen520li) wrote :

This bug still exists in UK15.10-0924.1-Daily-amd64&i386.

Changed in ubuntukylin:
milestone: wily-beta1 → wily-beta2
Changed in ubuntukylin:
milestone: wily-beta2 → wily-finalrelease
jiaowen520li (jiaowen520li) wrote :

This bug still exists in UK15.10-1019-Daily-amd64&i386.

jiaowen520li (jiaowen520li) wrote :

This bug still exists in UK16.04-Daily-0111-amd64&i386.

Changed in ubuntukylin:
milestone: wily-finalrelease → xenial-alpha2
tags: added: xenial-alpha2
Changed in casper (Ubuntu):
importance: Undecided → Medium
Changed in ubuntu-translations:
importance: Undecided → Medium
Changed in ubuntu-translations:
assignee: nobody → Ubuntu Simplified Chinese Translators (ubuntu-l10n-zh-cn)
zhangchao (zctgbhu) on 2016-02-01
Changed in ubuntukylin:
milestone: xenial-alpha2 → xenial-beta1
Aron Xu (happyaron) on 2016-02-02
Changed in ubuntu-translations:
assignee: Ubuntu Simplified Chinese Translators (ubuntu-l10n-zh-cn) → nobody
Changed in ubuntukylin:
milestone: xenial-beta1 → xenial-beta2
zhangchao (zctgbhu) on 2016-03-30
Changed in ubuntukylin:
milestone: xenial-beta2 → xenial-finalrelease
zhangchao (zctgbhu) on 2016-03-30
Changed in ubuntukylin:
importance: High → Low
Changed in casper (Ubuntu):
assignee: lenky0401 (lenky0401) → nobody
Changed in ubuntukylin:
assignee: lenky0401 (lenky0401) → ShuiLu Pi (pishuilu1128)
zhangchao (zctgbhu) on 2016-05-14
Changed in ubuntukylin:
milestone: xenial-finalrelease → yakkety-alpha1
jiaowen520li (jiaowen520li) wrote :

Live模式下,打开文件管理器,“Desktop”未被翻译为“桌面”,且文件管理器窗口左侧栏的“主文件夹”变为“Home”。
test version: ubuntu kylin-yakkety-alpha1

Changed in ubuntukylin:
milestone: yakkety-alpha1 → yakkety-beta1
Changed in ubuntukylin:
milestone: yakkety-beta1 → yakkety-beta2
Changed in ubuntukylin:
milestone: yakkety-beta2 → yakkety-finalrelease
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers