免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2478 | 回复: 2
打印 上一主题 下一主题

請教gtk 在 i18n上的問題. 先謝過. [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2005-03-28 16:54 |只看该作者 |倒序浏览
各位, 小弟正在寫一個gtk的程序, 但當加入i18n支援時就出現以下情況. 情況出現在GtkItemFactoryEntry內, 我想把menu內加入i18n功能.

  1. ....
  2. #include <libintl.h>;
  3. #include <stdio.h>;
  4. #define _(STRING) gettext(STRING)
  5. #define N_(STRING) gettext_noop(STRING)
  6. ...
  7. static GtkItemFactoryEntry menu_item[] =
  8. {
  9.         { N_("/Action"), NULL, NULL, 0, "<Branch>;"},
  10.         { N_("/Action/one"), NULL, one, 0, NULL},
  11.         { N_("/Action/sep1"), NULL, NULL, 0, "<Separator>;"},
  12.         { N_("/Action/Exit"), NULL, gtk_main_quit,  0, NULL},
  13.         { N_("/Help"), NULL, NULL, 0, "<Branch>;"},
  14.         { N_("/Help/About"), NULL, help, 0, NULL},
  15. };
复制代码

但它在編譯時出現以下錯誤:

  1. root@Compaq:~/setpppoe# ./build.sh
  2. interfunc.c:23: warning: implicit declaration of function `N_'
  3. interfunc.c:23: error: initializer element is not constant
  4. interfunc.c:23: error: (near initialization for `menu_item[0].path')
  5. interfunc.c:23: error: initializer element is not constant
  6. interfunc.c:23: error: (near initialization for `menu_item[0]')
  7. interfunc.c:24: error: initializer element is not constant
  8. interfunc.c:24: error: (near initialization for `menu_item[1].path')
  9. interfunc.c:24: error: initializer element is not constant
  10. interfunc.c:24: error: (near initialization for `menu_item[1]')
  11. interfunc.c:25: error: initializer element is not constant
  12. interfunc.c:25: error: (near initialization for `menu_item[2].path')
  13. interfunc.c:25: error: initializer element is not constant
  14. interfunc.c:25: error: (near initialization for `menu_item[2]')
  15. interfunc.c:26: error: initializer element is not constant
  16. interfunc.c:26: error: (near initialization for `menu_item[3].path')
  17. interfunc.c:26: error: initializer element is not constant
  18. interfunc.c:26: error: (near initialization for `menu_item[3]')
  19. interfunc.c:27: error: initializer element is not constant
  20. ......
复制代码


我已經查過很多貼及軟件包, 它們都是用這個方法為MENU加入i18n功能, 但我的就不能, 是否我打錯什麼, 請各位指教. thanks.

论坛徽章:
0
2 [报告]
发表于 2005-03-28 17:42 |只看该作者

請教gtk 在 i18n上的問題. 先謝過.

什么是i18n功能
多语言?
给我扫个盲
谢谢

论坛徽章:
0
3 [报告]
发表于 2005-03-28 22:54 |只看该作者

請教gtk 在 i18n上的問題. 先謝過.

i18n 是 internationalization 的縮寫, 由第一個i字到最後一個n字一共18個, 所以叫做i18n.
i18n的作用是可以把程式依系統的語言設定來改變程式的語言顯示, 對於程序員來說它只需要編寫一次程序碼就可以實現多語言的顯示. 例如常用的中文, 可分為簡體及繁體. 只要依著系統的 locale 設定 zh_CN.GB2312 及 zh_TW.Big5 那就可以輕易地顯示繁體及簡體了. 其他語言道理也是一樣的.

有興趣可參考http://i18n.linux.org.tw
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP