来回翻译Vista/W7中的本地化特殊文件夹 [英] Translating localized special folders in Vista/W7 back and forth

查看:98
本文介绍了来回翻译Vista/W7中的本地化特殊文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

要将特殊文件夹(C:\ Users,C:\ Program Files等)转换为本地化的等效文件(瑞典语:C:\Användare,C:\ Program等),可以使用Shell32函数SHGetFileInfo().

To translate a special folder (C:\Users, C:\Program Files, etc) into its localized equivalent (Swedish: C:\Användare, C:\Program, etc), you can use the Shell32 function SHGetFileInfo().

如何将本地化路径转换为规范化"路径?

How do you go about translating a localized path to a "normalized" path?

通常,您不必这样做,但是有在某些情况下,您必须执行此操作.在Windows Vista和更高版本中,本地化路径仅是连接点.这些连接点然后指向规范化"路径,非常类似于Unix中的符号链接.据我了解,连接点是动态的,并且在MUI的控制下.这意味着具有瑞典MUI设置的用户将具有与具有西班牙MUI设置的用户完全不同的路径集.

Normally, you don''t have to do this, but there are certain situations where you must do this. In Windows Vista and later, the localized paths are just junction points. These junction points then point to the "normalized" paths, much like symbolic links in Unix. From what I can understand, the junction points are dynamic, and under MUI control. Meaning that one user with a Swedish MUI setting will have a totally different set of paths than a user with a Spanish MUI setting.

我注意到,如果您使用本地化路径注册服务,则该服务将赢得无法启动,因为SYSTEM帐户未共享我的MUI设置.当我使用规范化路径重新注册服务时,它就可以正常工作.

I have noticed that if you register a service with a localized path, the service won''t start, because the SYSTEM account doesn''t share my MUI-settings. When I reregistered the service using the normalized path, it just worked.

我有一种算法,可以将本地化路径向后转换为规范化路径.不幸的是,我觉得这是一种笨拙且无效的算法,这就是为什么我正在寻求一种更好的方法来做到这一点.应该有一个系统函数可以为您完成此任务,但是我还没有找到一个函数.

I have an algorithm that can do backward translations of localized paths into normalized paths. Unfortunately I feel it''s a clumbsy and ineffective algorithm, which is why I''m seeking a better way to do this. There ought to be a system function that can do this for you, but I''ve yet to find one.

推荐答案

您找到解决方案了吗?为了这?您应该使用Environment.GetFolderPath(Environment.SpecialFolder.System)而不是翻译吗?

我怀疑Windows可能将英语作为主要语言,而资源文件中的所有其他语言值(如结构).如果您想自己翻译,我认为您需要使用.net资源文件(.resx).我会尽量避免全部使用&使用Environment.GetFolderPath(Environment.SpecialFolder.System),所以我们用机器术语来谈论,与语言无关.
Did you find a solution for this? Should you be using Environment.GetFolderPath(Environment.SpecialFolder.System) instead of translation?

I suspect Windows might have had English as thier primary language, and every other language values in resource files like structure. If you want to do a translation yourself, i think you need o use .net Resource files (.resx). I would try to avoid the whole lot & use Environment.GetFolderPath(Environment.SpecialFolder.System), so we talk in Machine terms, language independant.


不,我没有找到解决此问题的更好方法.自从我研究它已经有一段时间了,所以我不会发誓没有好的方法可以做到这一点.这仅意味着我的笨拙"解决方案超过了花费更多时间寻找替代产品的成本.

但是,如果您找到了一种好方法,请告诉我! :)
No, I haven''t found a better way to solve this. It''s been a while since I looked into it, so I won''t swear that there are no good ways to do this. It just means that my "clumbsy" solution outweighed the cost of spending more time on searching for a replacement.

But if you do find a good way, please let me know! :)


这篇关于来回翻译Vista/W7中的本地化特殊文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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