以简单的 XML 格式(子集)存储用户手册文本和类似文本是非常明智的做法。 XHTML、DOCBOOK)并对生成的 HTML 应用 XSL 转换。它可以轻松外包翻译并验证文档的格式。
该列表当然不是特定于 Web 应用程序的。
Having some experience in localization of the applications, I can tell you the following:
Any translator you can rely on, will not have problems with HTML (assuming that the translation would not break the design)
Most professional translators use translation memory applications (i.e., Transit, Trados) that can parse many document formats (XML, HTML, PDF, .DOC, etc.) and separate markup from content. They will deliver a translated copy in the same format as original.
All messages to be translated that are used within your programming code should be isolated in resource bundles. Almost all popular web-application frameworks have the corresponding means. The bundles are usually just plain text files with key/value pairs. Translator should not see the code.
Messages in resource bundles can be formatting strings for printf-like functions. In that case, you should document the expected 'fillers'.
When you provide resource bundles to translators, be sure to attach instructions how to get the texts in the application interface, so that the translator would know the context of the given message.
If any labels should not exceed a length, you should inform about it in advance.
If the application uses company-specific terminology, you should provide a glossary, so that the translation would be consistent.
Do your best to get rid of texts on images. Those will be your head ache.
If you translate from English, you might face the necessity to introduce additional logic to cover the grammatical features of the target language (correct case, gender)
it is very smart to store user manual text and similar texts in simple XML format (a subset of XHTML, DOCBOOK) and apply an XSL transformation for resulting HTML. It allows easily outsource the translation and validate the format of the document.
The list is certainly not web-application specific.
First of all, keep every translatable unit of text in a uniquely identified div tag on each web page. Store the content in a database table that has the div id and the language id as the key and a text field for the content. Allow basic HTML markup, but no script or styling.
Have a page on your system to set language preferences, and store it on the user's profile, or in a long-lasting cookie in the user's browser.
Have your web application render the unique div or span tags from the database based on the language preference.
You can have a separate application that displays the default text (e.g. English) and then has a text area for a translator to type in a translation. Once it is typed in, that div tag can be rendered in the language of the user's choice.
Another big thing to watch for is that some content is layout-independent, such as paragraphs, blog postings, etc. Other content is very layout-dependent such as menu items, headers, etc. Also, some languages such as Hebrew and Arabic go from right to left instead of left to right. That may affect how the translated content is laid out. In such situations, you may want a separate layout template for those languages, and the selection of the template would be driven by the language preference.
The best and most professional way is to provide a web interface for translation agencies. This way you can outsource the work anywhere you please.
Also think of embedding the UI into your development process. You add new textual resources to your application, they are automatically published in this UI. Agencies perform translation and mark this particular item as translated. The build picks up the already translated resources and substitutes stubs or default texts with those translations. If a string is reported as being incorrectly translated, you mark it to send for repeated translation again.
This is easily done when this is conceived from the beginning of the development. It's not exactly a feature you can easily add later, but it is of course possible.
For this to work, you need to store every translatable piece of text somewhere special. Either you keep them in a database, store in some XML file, you need two things:
Integrate those resources into your development process. For instance, when you compile a project, the resources are picked up from that storage and put into their proper places in the code, markup or whatever you do.
Provide external access to that storage. Add/delete rights only to yourself, add/modify translations for existing items for external users.
As the above individuals have mentioned - string externalization is in most respects the core concept in Internationalization/Localization. Your choice of bundles depends on platform - for C getText is a popular option.
While you could write a translation frontend, if you're mostly translating application UI (as opposed to content) then the above approach, combined with either a desktop app (there are many, you can just ship translators the String bundles, and they can edit and return) or, my favorite these days, Pootle (which is a web front-end, and can commit translations direct to SCM) can provide friendly frontends
我使用 jQuery DOM 操作技术根据用户所做的选择来翻译文本。我将所有文本及其相应的翻译存储到数据库中。还使用 asp.net 配置文件,我在登录/注销操作期间维护用户首选项。
此外,在您的应用程序中,为用户提供明确的选项来选择新语言,而不是依赖浏览器语言设置。
Most of the commercial websites maintain different webpage for different langues which obviously is not a feasible solution. Translation of webpage into an all together different language can be of two type : UI level and Functional Level.
At UI level , you translate the label text, button text, table Header , DropDown and menu options into their corresponding text in different language.
Functional level is where you have to work a bit harder by providing proper translation of datetime and currency fields. For e.g. 100 $ is not same as 100 Euro (A blunder I committed in my application!!)....
I used jQuery DOM manipulation technique to translate the text depending upon the selection made by the user. I stored all the text and their corresponding translation into Database.Also using asp.net profiles , I maintained users preference during login/logout operations.
Also in your application give user explicit option to select new language rather than relying on browser language settings.
I guess you should try i18next https://www.i18next.com/ here is the link. It is an internationalization-framework written in and for JavaScript. If you are good to go with java script or you are famlier with it this is the best thing, what this script basically do you can make multiple json files of different language and there will be a js function which will convert it from one language to another in server side only
发布评论
评论(7)
凭借在应用程序本地化方面的一些经验,我可以告诉您以下内容:
该列表当然不是特定于 Web 应用程序的。
Having some experience in localization of the applications, I can tell you the following:
The list is certainly not web-application specific.
首先,将每个可翻译的文本单元保存在每个网页上唯一标识的 div 标签中。将内容存储在数据库表中,该表以 div id 和语言 id 作为键以及内容的文本字段。允许基本的 HTML 标记,但不允许脚本或样式。
在您的系统上有一个页面来设置语言首选项,并将其存储在用户的个人资料中,或存储在用户浏览器的持久 cookie 中。
让您的 Web 应用程序根据语言首选项从数据库中呈现唯一的 div 或 span 标签。
您可以有一个单独的应用程序来显示默认文本(例如英语),然后有一个文本区域供翻译人员输入翻译。输入后,该 div 标签就可以用用户选择的语言呈现。
另一件需要注意的事情是,某些内容与布局无关,例如段落、博客文章等。其他内容非常依赖布局,例如菜单项、标题等。此外,某些语言(例如希伯来语和阿拉伯语)也可以使用布局。从右到左而不是从左到右。这可能会影响翻译内容的布局方式。在这种情况下,您可能需要针对这些语言的单独布局模板,并且模板的选择将由语言首选项驱动。
First of all, keep every translatable unit of text in a uniquely identified div tag on each web page. Store the content in a database table that has the div id and the language id as the key and a text field for the content. Allow basic HTML markup, but no script or styling.
Have a page on your system to set language preferences, and store it on the user's profile, or in a long-lasting cookie in the user's browser.
Have your web application render the unique div or span tags from the database based on the language preference.
You can have a separate application that displays the default text (e.g. English) and then has a text area for a translator to type in a translation. Once it is typed in, that div tag can be rendered in the language of the user's choice.
Another big thing to watch for is that some content is layout-independent, such as paragraphs, blog postings, etc. Other content is very layout-dependent such as menu items, headers, etc. Also, some languages such as Hebrew and Arabic go from right to left instead of left to right. That may affect how the translated content is laid out. In such situations, you may want a separate layout template for those languages, and the selection of the template would be driven by the language preference.
最好、最专业的方法是为翻译机构提供网络界面。这样您就可以将工作外包到任何您愿意的地方。
还要考虑将 UI 嵌入到您的开发过程中。您向应用程序添加新的文本资源,它们会自动在此 UI 中发布。代理机构执行翻译并将该特定项目标记为已翻译。该构建会选取已翻译的资源,并用这些翻译替换存根或默认文本。如果报告某个字符串翻译错误,您可以将其标记为再次发送以进行重复翻译。
如果从开发之初就构思了这一点,那么这很容易完成。这并不是一个可以在以后轻松添加的功能,但它当然是可能的。
为此,您需要将每段可翻译的文本存储在特殊的地方。要么将它们保存在数据库中,要么存储在某个 XML 文件中,您需要做两件事:
将这些资源集成到您的开发过程中。例如,当您编译项目时,将从该存储中获取资源并将其放入代码、标记或您所做的任何操作中的适当位置。
提供对该存储的外部访问。仅添加/删除您自己的权限,为外部用户添加/修改现有项目的翻译。
The best and most professional way is to provide a web interface for translation agencies. This way you can outsource the work anywhere you please.
Also think of embedding the UI into your development process. You add new textual resources to your application, they are automatically published in this UI. Agencies perform translation and mark this particular item as translated. The build picks up the already translated resources and substitutes stubs or default texts with those translations. If a string is reported as being incorrectly translated, you mark it to send for repeated translation again.
This is easily done when this is conceived from the beginning of the development. It's not exactly a feature you can easily add later, but it is of course possible.
For this to work, you need to store every translatable piece of text somewhere special. Either you keep them in a database, store in some XML file, you need two things:
Integrate those resources into your development process. For instance, when you compile a project, the resources are picked up from that storage and put into their proper places in the code, markup or whatever you do.
Provide external access to that storage. Add/delete rights only to yourself, add/modify translations for existing items for external users.
正如上面的人所提到的 - 字符串外部化在大多数方面都是国际化/本地化的核心概念。您选择的捆绑包取决于平台 - 对于 C getText 是一个流行的选择。
虽然您可以编写翻译前端,但如果您主要翻译应用程序 UI(而不是内容),则将上述方法与桌面应用程序相结合(有很多,您可以将字符串包发送给翻译人员,他们可以编辑并返回)或者,这些天我最喜欢的 Pootle (这是一个网络前端-end,并且可以直接将翻译提交给 SCM)可以提供友好的前端
As the above individuals have mentioned - string externalization is in most respects the core concept in Internationalization/Localization. Your choice of bundles depends on platform - for C getText is a popular option.
While you could write a translation frontend, if you're mostly translating application UI (as opposed to content) then the above approach, combined with either a desktop app (there are many, you can just ship translators the String bundles, and they can edit and return) or, my favorite these days, Pootle (which is a web front-end, and can commit translations direct to SCM) can provide friendly frontends
大多数商业网站为不同的语言维护不同的网页,这显然不是一个可行的解决方案。将网页翻译成不同的语言可以有两种类型:UI 级别和功能级别。
在 UI 级别,您将标签文本、按钮文本、表格标题、下拉菜单和菜单选项翻译成不同语言的相应文本。
功能级别是您必须通过提供日期时间和货币字段的正确翻译来更加努力地工作的地方。例如,100 美元与 100 欧元不同(我在应用程序中犯下的一个错误!)...
我使用 jQuery DOM 操作技术根据用户所做的选择来翻译文本。我将所有文本及其相应的翻译存储到数据库中。还使用 asp.net 配置文件,我在登录/注销操作期间维护用户首选项。
此外,在您的应用程序中,为用户提供明确的选项来选择新语言,而不是依赖浏览器语言设置。
Most of the commercial websites maintain different webpage for different langues which obviously is not a feasible solution. Translation of webpage into an all together different language can be of two type : UI level and Functional Level.
At UI level , you translate the label text, button text, table Header , DropDown and menu options into their corresponding text in different language.
Functional level is where you have to work a bit harder by providing proper translation of datetime and currency fields. For e.g. 100 $ is not same as 100 Euro (A blunder I committed in my application!!)....
I used jQuery DOM manipulation technique to translate the text depending upon the selection made by the user. I stored all the text and their corresponding translation into Database.Also using asp.net profiles , I maintained users preference during login/logout operations.
Also in your application give user explicit option to select new language rather than relying on browser language settings.
我想你应该尝试 i18next https://www.i18next.com/ 这里是链接。
它是一个用 JavaScript 编写的国际化框架。如果你擅长使用java脚本或者你更熟悉它,这是最好的事情,这个脚本基本上做什么,你可以制作不同语言的多个json文件,并且会有一个js函数将其从一种语言转换为另一个仅在服务器端
I guess you should try i18next https://www.i18next.com/ here is the link.
It is an internationalization-framework written in and for JavaScript. If you are good to go with java script or you are famlier with it this is the best thing, what this script basically do you can make multiple json files of different language and there will be a js function which will convert it from one language to another in server side only