仅使用公式进行本地化即可获取当前的文化 [英] Get current culture using just formula for localization purpose
问题描述
有没有一种方法可以使用Excel中的公式不使用任何VBA代码来确定当前的系统区域性?
Is there a way how to determine current system culture using a formula in Excel wihout using any VBA code?
我想像这样简单的事情:
I imagine something simple like this:
IF(CULTURE="sk-SK","Prehľad","Overview")
或者类似的事情也会对我有用:
or also something like this would do for me:
IF(CURRENCYSIGN="€","Prehľad","Overview")
我正在寻找一种全球化XLSX文件的简单方法,而无需任何其他资源或文件.
I am looking for a simple way to globalize XLSX file without any additional resources or files needed.
推荐答案
否,没有VBA就无法获得系统语言设置.根本没有内置功能.但是,如果您考虑使用UDF,则有一个解决方案:
No, there is no way to get system language settings without VBA. There is simply no built-in function for this. But if you consider UDF, there's a solution:
Public Function GetLang()
GetLang = Application.LanguageSettings.LanguageID(msoLanguageIDUI)
End Function
但是,在您的帮助下,我们找到了一个窍门.您可以通过分析公式文本来猜测系统语言(仅在Excel 2013中):
However, with your help we have found a trick. You can guess the system language by analyzing formula text (only in Excel 2013):
A1=TODAY()
=IF(FORMULATEXT(A1)="=TODAY()",[some logic for English system],[some logic for non-English system])
或通过分析本地月份名称:
Or by analyzing local month name:
=IF(TEXT(1,"mmmm")="January",[some logic for English system],[some logic for non-English system])
这篇关于仅使用公式进行本地化即可获取当前的文化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!