VB 6 源代码,语音文本是法语想要翻译成英语 [英] VB 6 source code, speech text is in french want to translate to english

查看:12
本文介绍了VB 6 源代码,语音文本是法语想要翻译成英语的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个可能对我有用的程序,但文档和所有工具提示都使用我看不懂的语言.源代码可用,整个东西大约有 84,000 行代码.我的问题是有没有一种方法可以导出或抓取工具提示文本、按钮文本、最终用户作为任何可读消息的一部分出现的内容以便轻松翻译文本?

I have a program that could be useful to me but the documentation and all tooltips are in a language I can't read. The source code is available and the entire thing is about 84,000 lines of code. My question is is there a way to export or grab just for example tooltip text, button text, things that would appear to the end user as part of any readable messages in order to easily translate the text?

推荐答案

一种可能的方法是使用知道如何转换 VB6 程序的东西.它需要解析 VB6,提取所有文字字符串,将它们提供给您进行翻译,并用您的替换替换原始字符串.实际上,您需要两次传递,第一次生成集合,使您能够翻译感兴趣的内容,第二次替换您指定的翻译(如果有).您可能需要进行一些调试,因为通常有些事情取决于字符串大小.

One possible approach is to use something that knows how to transform a VB6 program. It would need to parse VB6, pull out all the literal text strings, offer them to you for translation, and substitute your replacements for the original strings. Actually, you want two passes, the first to produce the set enabling you to translate the ones of interest, and the second to substitute your designated translations if any. You likely have some debugging to do, because usually there is something that depends on the string size.

如何将字符串从一种语言转换为另一种语言取决于您.正如其他海报所建议的那样,您可以使用在线翻译器并获取您所得到的.如果有人来做,我希望你会做得更好.它们通常只需要关注字符串的含义,因为它们是从代码中提取的,但您也会发现翻译取决于代码正在做什么的情况,因此需要程序员参与.

How you go about converting the strings from one language to another is up to you. As other posters suggest, you could use an online translator and take what you get. I would expect you will do better if you have a human being do it. They generally only have to focus on the meaning of the strings, since they are extracted from the code, but you will also find cases where the translation depends on what the code is doing, and so a programmer will need to be involved.

我们的 DMS 软件再造工具包及其 Visual Basic 前端 可以轻松配置为执行此操作.DMS 提供通用解析和转换机制;VB 前端提供了有关 Visual Basic 6 的详细信息(在您的情况下).

Our DMS Software Reengineering Toolkit with its Visual Basic Front End could be easily configured to do this. DMS provides generic parsing and transformation machinery; the VB front end provides the details about Visual Basic 6 (in your case).

这个想法的一个变体是用包含原始(法语)或新(英语)的资源"(相当于由字符串编号索引的查找表)的引用替换翻译的文字字符串.这个解决方案产生的东西接近于进行国际化的人们想要做的事情.(这不考虑日期和货币格式;那些需要数据流分析来确定导致/来自日期或货币操作的计算.虽然不需要文字字符串转换,但 DMS 提供流分析,因此可以配置为这个也是.)

A variation of this idea is to replace translated literal strings with references to "resources" (what amounts to a lookup table indexed by a string number) which contain either the original(French) or new (English). This solution produces something close to what people doing internationalization want to do. (This doesn't take care of dates and currency formats; those require data flow analysis to determine computations leading to/from date or currency operations. While not needed for literal string conversion, DMS provides flow analysis, so it could be configured to do this, too.)

如果您有关于文本中字符串位置的精确信息(例如,起始行/列、结束行/列),您可以通过另一种方式执行此操作:使用该精确信息提取字符串,然后使用相同的精确信息重新插入翻译.为避免损坏字符串位置,您应该首先替换从每个文件末尾开始的字符串,然后在整个文件中向后工作.在文本缓冲区上执行此操作应该很简单.

If you have precise information about the location of the strings in the text (e.g., starting line/column, ending line/column), you can do this another way: use that precise information to extract the strings, and then use that same precise information to re-insert the translations. To avoid damaging the string locatons, you should replace strings starting at the end of each file first, working backwards throught the file. This should be straightforward to do on a buffer of text.

我们的 源代码搜索引擎 (SCSE) 可用于轻松查找此类字符串及其地点.SCSE 根据其词法结构对源代码进行索引(从而准确地看到字符串文字),然后全部允许跨源代码查询任意标记序列.它使用 DMS 的语言前端(为了您的目的,VB6 前端)准确地挑选出词位.

Our Source Code Search Engine (SCSE) can be used to trivially find such strings and their locations. The SCSE indexes source code according to its lexical structure (and thus sees the string literals exactly), and then all allows queries across the source code for arbitrary sequences of tokens. It uses DMS's language front ends (for your purpose, the VB6 front end) to pick out the lexemes accurately.

人们可能会寻找将大于 10 的常量(使用范围约束)分配给名称包含 X(使用通配符)的变量的语句,查询如下:

One might hunt for statatements that assign a constant more than 10 (using a range constraint) to a variable whose name contains an X (using a wildcard) with a query like this:

 I=*x* '=' N>10

SCSE 将找到所有匹配项,向您显示匹配项,并且只需单击一次即可在源代码中查看匹配项.

The SCSE will find all matches, show you the hits, and enable seeing the hit in the source code with one additional click.

要查找文字字符串的查询非常简单:

The query you want to find literal strings is extremely simple:

 S=*

意思是查找所有字符串而不考虑内容".您可以打开 SCSE 日志记录,它会将所有命中的列表以及精确位置写入日志文件.至此,您就拥有了所有精确的字符串信息.(SCSE 不能做流量分析,所以它不能像 DMS 那样帮助国际化日期,但它可以找到

meaning, "find all strings regardless of content". You can turn on SCSE logging, and it will write a list of all the hits, along with precise positions, to a log file. A this point you have all the precise string information. (SCSE cannot do flow analysis so it can't help internationize dates as well as DMS could, but it could find

 N 'mod' 4 '==' 0 

模式,往往是闰年调整).

patterns, which tend to be leap year adjustments).

这篇关于VB 6 源代码,语音文本是法语想要翻译成英语的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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