Localization engineering examples

1.     Example of Internationalization - analyzing an ini file for netfx perfmon on XP/Vista/Win7 OS.

The ini file(installed by default at C:/Windows/inf/.NETFramework/corperfmonsymbols.ini ) for OS performance monitor, which contains some Counter names and descriptions for 23 languages.

Run some testing on chs/cht/ptg/ptb machines to see correct localized strings are loaded for the languages?

Steps:

1.      Set up a localized OS

2.      Install netfx 4.5 from Dev11 Main

3.      Launch “Performance Monitor” – go to Start/Run and type perfmon.

4.      When the Perf Monitor is launched, click “Add” icon (+ sign).

5.      Select the available counters and see which localized strings (what LCID) are loaded for counter names and descriptions for the language.

6.      Deliberately use lodctr C:/Windows/inf/.NETFramework/corperfmonsymbols.ini to let it show translated string  for Vista/Win7 to know if the string comes from the INI file.

7.      For simply installing netfx 4.5 runtime (not using lodctr ini), the result as below:

 

OS Language

CHS (804)

CHT(404)

PTB (416)

PTG (816)

OS Version

Windows XP

004

004

016

016

Vista

009

009

009

009

Win 7

009

009

009

009

Win 7 with 4.5 ini (Win8)

 804

404

 416

816

From the test result we know that

  • 004/016 strings should be kept for XP.
  • 804/404/416/816 is the right ID for Vista/Win7.

    

2.     Excel VBA example – A program/macro replacing strings in two separate sheets by IDs.

We have a large xml file in sheet1 which contain key and values. And a smaller xml file in sheet 2, which contain some fixed translation of the large file. Running the macro can replace the strings in sheet1 with the fixed/updated strings in sheet2 by IDs. Below is the code:

Sub ReplacePDN()

    Dim x As Integer

x = 1

    'loop times is the lines in fixed sheet'

Do Until x = 156

    Sheets("Fixed").Select

    Cells(x, 2).Select

‘in Fixed sheet, the ID of the firstline’   

FindID = ActiveCell.Value

‘RPSource have a fixed string’   

RPSource = ActiveCell.Offset(0, 2).Value

 ‘Find in Default sheet by ID’ 

 Sheets("Default").Select

    Columns("B:B").Select

    Set c = Selection.Find(What:=FindID)

    If Not c Is Nothing Then

    Selection.Find(What:=FindID, After:= _

        ActiveCell, LookIn:=xlFormulas, LookAt:=xlWhole, SearchOrder:=xlByRows, _

        SearchDirection:=xlNext, MatchCase:=False, SearchFormat:=False).Activate

    End If

 

    '选中该ID对应的值'

    ActiveCell.Offset(0, 2).Activate

    '替换值'

    ActiveCell.Value = RPSource

    x = x + 1

    Loop

End Sub

3. Example of search and replace using regular expression

– a style guide change in TMX file, replacing Egnlish +(CHSUI) with “Egnlish +(CHSUI)”
the difficulty is, it’s not the distinguish form in the tmx file, there’s Egnlish +(CHS) strings that should not be quoted. The workaround is:

1. In UltraEditor, extract all the Egnlish +(CHS) form to a txt file.

2. Use gawk, Extract all the Egnlish +(CHSUI) form to a txt file.

3. Review this list manually, delete the false ones.

4. Create a search and replace macro, and run in the orginal tmx file, replacing safely.

4. Example of Dos Batch script for bulk processing, foder restructure, copy files for multiple components for multiple languages.

@echo off

set rootlocation=D:/Projects/IIS_Falcon/HO2/1_preprocessed

set Lang=LanguageList.config

Set MOD=Modules.config

                echo.

                for /F "usebackq delims=; tokens=1,2" %%a in (%LANG%) do (

                                for /F "usebackq delims=; tokens=1*" %%x in (%MOD%) do (

                                echo ============================================================

                                if not exist "%rootlocation%/%%a/%%x" (

                                echo creat lang folder

                                md "%rootlocation%/%%a/%%x"

                                )

                                echo.

                                echo D|xcopy /S/E "%rootlocation%/_HB/WebPI+Setup/%%a/webpi/managed/*.lcl" "%rootlocation%/%%a/%%x/managed"

                                echo D|xcopy /S/E "%rootlocation%/_HB/WebPI+Setup/%%a/Setup/*.lcl" "%rootlocation%/%%a/Setup"

                                echo.

                )

)

Pause

5.     Example of UI file markup

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值