本地语言的布尔值 [英] Boolean values in local language

查看:65
本文介绍了本地语言的布尔值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

很久以前在

This question has been asked long time ago on serverfault but no working awnser. I'm hoping somebody has encountered it and found a solution since then.

示例:

<%
Response.Write True
Response.Write "<hr>"
Response.Write "test:" & True
%>

输出:

True
--------------
test:Waar

正如您所看到的,一旦您合并了输出,它就会变成一个本地字符串('Waar'是荷兰语,代表true).我需要它保持真实".

As you can see, as soon as you combine the output, its turned into a local string ('Waar' is dutch for true). I need it to stay "True".

我该如何更改?我不介意在页面的开头放置一些代码,但是我无法在整个代码中更改所有 True 的实例.因此,创建如下所示的函数以返回正确的字符串是不会的.

How can I change this? I dont mind putting some code at the beginning of the pages, but I cannot change all instances of True in the entire code. So creating a function like below to return the correct string wont do.

Function PB(pVal)
  If pVal Then
    PB = "true"
  Else
    PB = "false"
  End If
End Function

推荐答案

奇怪的是,无论设置了哪种语言环境,我都无法让IIS以本地语言输出布尔值.

Strange, I cannot get my IIS to output a boolean value in my local language no matter which locale is set.

您是否已找到此 KB文章?

有一个注册表设置的描述可以解决这个问题:

There is a description of a registry setting that could do the trick:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\OLEAUT

我不想弄乱我的生产服务器,所以我还没有尝试过.

I don't want to mess with my production server, so I didn't try this yet.

第一答案:

您可以欺骗" VB以使用自己的功能.如果将这些功能添加到页面顶部,则VB会优先选择内置功能,在本例中为 CStr Trim .也许有帮助.

You could 'trick' VB to use your own functions. If you add these functions to the top of your page, VB will prefer these over the builtin ones, in this case CStr and Trim. Maybe this helps.

    Function PB(pVal)
        If pVal Then
            PB = "true"
        Else
            PB = "false"
        End If
    End Function

    Function CStr(pVal)
        CStr = PB(pVal)
    End Function

    Function Trim(pVal)
        Trim = PB(pVal)
    End Function

输出:

    True
    --------------
    test:true
    --------------
    test:true
    --------------
    test:true

这篇关于本地语言的布尔值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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