如何翻译 STF 文件
现在的项目已非之前那么简单,在word里进行翻译,而是涉及到很多复杂甚至专业的知识,例如软件、数据库、排版等,碰到各种要求的项目和各种文件类型,如何处理成为整个项目能否有效进行的关键所在。
例如碰到一个STF类型的文件改如何处理?
STF首先非常规文件扩展名,通过搜索得知为 Salesforce 的专用格式文件。
现在分析其文件内容找寻规律。
# Use the Source file to translate labels for the first time.
# – Change the language code in the header from the organization’s default language to the translation language. See “Supported Languages for Translatable Customizations” in the Salesforce.com online help for a list of supported languages and their associated language codes.
# Notes:
# Don’t add columns to or remove columns from this file.
# Tabs (\t), new lines (\n) and carriage returns (\r) are represented by special characters in this file. These characters should be preserved in the import file to maintain formatting.
# Lines that begin with the # symbol are ignored during import.
# Salesforce translation files are exported in the UTF-8 encoding to support extended and double-byte characters. This encoding cannot be changed.
# Language: English
Language code: en_US
Type: Source
# KEY LABEL
ButtonOrLink.Contract__c.Submit_for_Approval Submit for Approval
ButtonOrLink.Request_Line_Item__c.Add_Line_Item Add Line Item
ButtonOrLink.Bulletin_Delivery_Job__c.Execute Execute
ButtonOrLink.Bulletin_Delivery_Job__c.Submit_Defective_Job Submit Defective Job
按照客户给的要求,我们需要翻译的仅为上文中蓝色高亮(加粗)的部分
现在就该想办法把其他的内容屏蔽掉,让工具只读取该翻译的部分。
其实通过分析文件不难发现,整个文档规律性很强。
比如
ButtonOrLink.Bulletin_Delivery_Job__c.Execute Execute
都是前面一串代码类型的文字+制表符Tab+待译文字
遇到这种情况,可以搬出我们万能的正则表达式来为这个stf格式的文件撰写filter了。
上面所描述的文字对应的Regex为:
ButtonOrLink.Bulletin_Delivery_Job__c.Execute Execute
(.*?)\t(.*?)
然后让CAT工具仅读取后面那个括号里的内容,既$2就行。
Need a translation service?
Please enter your personal details and we will contact you shortly
Words translated by CCJK
146,096,379Over 95% of our clients recommend our language services to others