gettext:如何退回到基本语言? [英] gettext: How to fall back to the base language?

查看:102
本文介绍了gettext:如何退回到基本语言?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我计划使用wxWidgets重写我们的应用程序.也正因为如此,我想使用gettext处理人类语言的方式.我们目前使用其中四个:捷克语,斯洛伐克语,英语和德语.具体的语言不是那么重要.

I am planning to rewrite our application using wxWidgets. Also because of that I would like to use the gettext way of working with human languages. We currently use four of them: Czech, Slovak, English, and German. The specific languages are not that important.

重要的是,捷克语和英语被视为基本语言.这意味着,如果用法切换到德语,并且在那里未定义文本,则他或她会自动获取英语文本(此处的gettext没问题).但是,当用户使用斯洛伐克语时,后备语言为捷克语.而且,当用户使用英语时,它甚至可以退回到捷克语(开发人员的一种错误,因为英语也应该是完整的).

What is important, the Czech and English are considered a kind of base languages. This means that if the use switches to German, and the text is not defined there, he or she automatically gets the English text (no problem with gettext here). However, when the user uses Slovak, then the fallback language is Czech. And when the user uses English it can even fall back to Czech (a kind of bug by developers as English should also be complete).

我知道gettext默认使用一种语言-直接在源代码中编写.其他语言以.mo文件形式提供.刚开始使用gettext和wxWidgets ...

I know that gettext uses one language as a default -- written directly in the sources. The other languages are supplied as .mo files. Being new to gettext and wxWidgets...

有什么方法可以实现对默认语言(即源文件)不同的另一种显式语言的后备?换句话说,内存中是否可以存在更多语言并进行动态切换?

Is there any way to implement the fallback to another explicit language that differs from the default language (i.e. from source files)? In other words, can more languages be present in memory and switched dynamically?

感谢您的时间和经验,

石油

推荐答案

不,您不能有选择地提供此类后备. OTOH绝对没有什么可以阻止您将捷克语翻译复制到斯洛伐克语(即cp cz.po sk.po),然后仅将其中一些替换为真正的斯洛伐克语翻译.而且,当然,对于德语,如果您在来源中使用英语,它应该会自动运行(即使您的母语是捷克语,我也强烈建议您这样做).

No, you can't selectively provide such fallbacks. OTOH absolutely nothing prevents you from copying Czech translations to Slovak ones (i.e. cp cz.po sk.po) and then replacing only some of them with the real Slovak translations. And, of course, for German it should work automatically if you use English in your sources (and even if your native language is Czech, I strongly advise you to do this).

这篇关于gettext:如何退回到基本语言?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆