技术译文
最后更新于:2022-04-02 01:44:03
## 原文
Having opened this cookbook, you are probably eager to inject some of the ungainly strings of parentheses and question marks you find in its chapters right into your code. If you are ready to plug and play, be our guest: the practical regular expressions are listed and described in Chapters 4 through 9.
But the initial chapters of this book may save you a lot of time in the long run. For instance, this chapter introduces you to a number of utilities-some of them created by the authors, Jan and Steven-that let you test and debug a regular expression before you bury it in code where errors are harder to find. And these initial chapters also show you how to use various features and options of regular expressions to make your life easier, help you understand regular expressions in order to improve their performance, and learn the subtle differences between how regular expressions are handled by dif- ferent programming languages-and even different versions of your favorite programming language.
So we’ve put a lot of effort into these background matters, confident that you’ll read it before you start or when you get frustrated by your use of regular expressions and want to bolster your understanding.
## 译文及剖析
Having opened this cookbook, you are probably eager to inject some of the ungainly strings of parentheses and question marks you find in its chapters right into your code. If you are ready to plug and play, be our guest: the practical regular expressions are listed and described in Chapters 4 through 9.
当打开这本书的时候,你或许想将从此书的某些章节里找到的用括号和问号构成的生僻字符串放到你的代码里,如果你准备好用这样的方式即插即用,那么你就是我们的客户:4到9章将介绍实战用的正则表达式。
**having opened的时态没有翻译出来;ungainly的意思是”难看、笨拙的“,翻译错了;”你或许想将从此书的某些章节里找到的用括号和问号构成的生僻字符串放到你的代码里“太长,应当切开;plug and play翻译为”即插即用“有点奇怪,可考虑改为”随查随用“、”即抄即用“;be our guest的意思弄错了,应当是”请随意“;practical的意思不是”实战“,而是”实际用得上的/有实际用途的“,list and describe不能简单用”介绍“来翻译。**
But the initial chapters of this book may save you a lot of time in the long run. For instance, this chapter introduces you to a number of utilities-some of them created by the authors, Jan and Steven-that let you test and debug a regular expression before you bury it in code where errors are harder to find. And these initial chapters also show you how to use various features and options of regular expressions to make your life easier, help you understand regular expressions in order to improve their performance, and learn the subtle differences between how regular expressions are handled by dif- ferent programming languages-and even different versions of your favorite programming language.
而核心的章节主要是让你少走弯路。例如这一章将介绍很多作者写的工具,这些工具使你能够在正则表达式正式加入到那些错误难以掌控的代码之前做测试跟 调试。并且这些核心章节使你了解多种正则表达式之特性和选项的用法从而使你的生活更轻松,使你理解正则表达式从而能够强化正则表达式的性能,以及明白不同 编程语言甚至同种编程语言的不同版本在处理正则表达式上的细微差异。
**in the long run没有翻译出来;initial的意思(两处)翻译错了;may的意思没表达出来;utilities只有一部分是Jan和Steven写的;”做跟踪和调试“的对象不明确,”错误难以掌控的代码“完全偏离原文,原文意思是”代码中的错误很难掌控“;”从而使“的说法太累赘,可直接改为”让你的生活更轻松“;”从而能够强化正则表达式的性能“累赘且搭配不当,可改为”提升/优化正则表达式的性能“;”以及“可改为”并“;最后一句的favorite没有翻译出来。**
So we’ve put a lot of effort into these background matters, confident that you’ll read it before you start or when you get frustrated by your use of regular expressions and want to bolster your understanding.
所以我们花了大量精力来解决上述技术背景的问题,只是为了让你在开始或已经处于正则表达式的困扰并希望得到解脱之时能读到这本书。
**“背景的问题”不通顺,可直接翻译为“背景知识”、“背后的问题”;“只是为了让你在开始或已经处于正则表达式的困扰并希望得到解脱之时能读到这本书”太长,应当把“开始”和“已经陷入困扰”切开为两个分局;bolster your understanding可翻译为“深化理解”,而不是“得到解脱”。**
## 总评
这是某本技术书籍中的序言,语言浅显直白,没有出现太多典故。一般的技术人员都可以读懂原文,但是翻译这类文字,需要更多的耐心和细致。
译文并不妨碍读者理解原文的主要意思,但小的缺陷很多,许多单词和短语的意思翻译错了,比如第二段的initial和favorite,或者干脆漏掉没有翻译,比如第二段的in the long run和may。对于序言来说,这些问题不大,如果是细致讲解原理的文字,这样的缺陷就非常要命,失之毫厘,差之千里。
译文的另一个问题是长句太多,比如“这些工具使你能够在正则表达式正式加入到那些错误难以掌控的代码之前做测试跟调试”,“使你理解正则表达式从而能够强化正则表达式的性能,以及明白不同编程语言甚至同种编程语言的不同版本在处理正则表达式上的细微差异”,在阅读时它们都会影响到读者的理解,应当按照中文的习惯拆分开来,比如第一句就可以拆分为“依靠这些工具,你事先测试并调试好正则表达式,再放入代码,因为在代码中找出正则表达式的错误更加困难”。
';