重拾VB6(31):International Issues

来自MSDN-2001-OCT: Visual Tools and Languages/Visual Studio 6.0 Documentation/Visual Basic Documentation/Using Visual Basic/Programmer’s Guide/Part 2: What Can You Do With Visual Basic/International Issues/

1. Some Terms and Basics

(1) A locale is made up of a unique combination of a language and a country. Two examples of locales are: English/U.S. and French/Belgium.

(2) String resources refers to all the text that appears in the application's user interface. They include, but are not limited to, menus, dialog boxes, and informational, alert, and error messages. If an application will be used in a locale other than the one in which it was developed, these resources will have to be translated, or localized.

(3) It is a lot more efficient to design your application with localization in mind, following an approach that separates string resources from code, than to revise your finished application to make it international later in the development process.

(4) Any application that will be localized represents two conceptual blocks: a code block and a data block.

The data block contains all the user-interface string resources but no code. Conversely, the code block contains only the application code that is run for all locales.

In theory, you can develop a localized version of your Visual Basic application by changing only the data block. The code block for all locales should be the same.

2. 和界面相关的

(1) When you are writing Visual Basic code, you can use the LoadResString, LoadResPicture, and LoadResData functions in place of references to string literals, pictures, and data. 这样不仅方便本地化,也提高性能减少代码大小。

(2) Because text tends to grow when you localize an application, you should pay special attention when designing the following user interface (UI) components: Messages(小心太长文字要拐弯), Menus and dialog boxes(小心文字太长导致控件位置不当), Icons and bitmaps(确认它们是文化认同的,同时是不带文字的), Access and shortcut keys(注意各国的键盘可能不同).

3. code module要注意的

(1) You should identify the strings that need to be localized, allow for strings to grow, and avoid the pitfalls of string concatenation.

(2) The buffer size you declare in your Visual Basic code must account for this increase.

(3) 在不同的语言里两个字符串相加得到的结果可能不同

(4) it is also important to know that words or sentences that appear identical in English may need to be translated into different words or sentences when localized.

4. Writing International Code in Visual Basic

(1) The system locale is the locale of the user who runs your program — it is used as a reference for user input and output and uses Control Panel settings provided by the operating system. The code locale is always English/U.S. in Visual Basic, regardless of which international version you use.

(2) Date: In Visual Basic, never type dates as strings in your code. Entering dates in code in the format #month/day/year# ensures that the date will be interpreted correctly in any system locale.

(3) Currency: Avoid typing currencies as strings in your code.

(4) Numeric Values and Separators: Instead, use the CStr, CDbl, CSng, CInt, and CLng functions to provide international conversions from any other data type to the data type you need. These functions use the system locale to determine the decimal separator.

5. Locale-Aware Functions

(1) In Visual Basic, many functions use the user's system locale, which uses the Control Panel settings provided by the operating system to automatically determine the conventions at run time. These functions are called locale-aware functions.

(2) Print Method

(3) Format Function: Using named formats produces output that is based on the user's system locale. The named formats can even generate output in the user's native language, including the names of months and days of the week.

6. International Sort Order and String Comparison

(1) Correct international sorting can imply context-sensitive sorting. 另外还有可能一个字变俩字,俩字变1个。另外不同的语言可能使用不同的“code pages”.

(2) Visual Basic provides a number of tools, such as Like and StrComp, which are locale-aware.

(3) Option Compare Statement: If you specify Binary, comparisons are done according to a sort order derived from the internal binary representations of the characters. If you specify Text, comparisons are done according to the case-insensitive textual sort order determined by the user's system locale. The default text comparison method is Binary.

(4) Comparing Strings with the Like Operator: When character ranges are used with Like, the specified pattern indicates a range of the sort ordering. 在某些语言里这可能会导致有些字母被漏掉。

7. International File Input/Output

(1) Locale is also an important consideration when working with file input and output in Visual Basic. Both the Print # and Write # statements can be used to work with data files, but they have distinct purposes.

(2) The Input # statement cannot read locale-aware data in Visual Basic that has been written to a file with the Print # statement. To write locale-independent data that can be read by Visual Basic in any locale, use the Write # statement instead of the Print # statement.

8. Locale-Aware SQL Queries Based on Dates

(1) In Visual Basic, the database engine stores a date/time value as a DateSerial value, which is represented by an 8-byte floating-point number, with the date as the integral portion and the time as the fractional portion. This approach is completely locale-independent and will let you perform date/time comparisons using the international date/time formats.

(2) Structured Query Language (SQL) is an ANSI standard with which Visual Basic complies. Dates are saved in tables and databases using the English/U.S. format (month/day/year). This format was also adopted for the Microsoft Jet database engine. Queries that use these fields may return the wrong records or no records at all if a non-U.S. date format is used.

This constraint also applies to the Filter property, to the FindFirst, FindNext, FindPrevious, and FindLast methods of the Recordset object, and to the WHERE clause of an SQL statement.

(3) Avoid using date/time literals in your code. Instead, consider using the DateValue or the DateSerial functions to generate the date you want. The DateValue function uses the system's Short Date setting to interpret the string you supply; the DateSerial function uses a set of arguments that will run in any locale. If you are using date/time literals in your SQL query or with the Filter property, you have no choice but to use the English/U.S. format for date and time.

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
城市应急指挥系统是智慧城市建设的重要组成部分,旨在提高城市对突发事件的预防和处置能力。系统背景源于自然灾害和事故灾难频发,如汶川地震和日本大地震等,这些事件造成了巨大的人员伤亡和财产损失。随着城市化进程的加快,应急信息化建设面临信息资源分散、管理标准不统一等问题,需要通过统筹管理和技术创新来解决。 系统的设计思路是通过先进的技术手段,如物联网、射频识别、卫星定位等,构建一个具有强大信息感知和通信能力的网络和平台。这将促进不同部门和层次之间的信息共享、交流和整合,提高城市资源的利用效率,满足城市对各种信息的获取和使用需求。在“十二五”期间,应急信息化工作将依托这些技术,实现动态监控、风险管理、预警以及统一指挥调度。 应急指挥系统的建设目标是实现快速有效的应对各种突发事件,保障人民生命财产安全,减少社会危害和经济损失。系统将包括预测预警、模拟演练、辅助决策、态势分析等功能,以及应急值守、预案管理、GIS应用等基本应用。此外,还包括支撑平台的建设,如接警中心、视频会议、统一通信等基础设施。 系统的实施将涉及到应急网络建设、应急指挥、视频监控、卫星通信等多个方面。通过高度集成的系统,建立统一的信息接收和处理平台,实现多渠道接入和融合指挥调度。此外,还包括应急指挥中心基础平台建设、固定和移动应急指挥通信系统建设,以及应急队伍建设,确保能够迅速响应并有效处置各类突发事件。 项目的意义在于,它不仅是提升灾害监测预报水平和预警能力的重要科技支撑,也是实现预防和减轻重大灾害和事故损失的关键。通过实施城市应急指挥系统,可以加强社会管理和公共服务,构建和谐社会,为打造平安城市提供坚实的基础。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值