如何使用C#和.Net技术编辑XLIFF文件格式 [英] how to edite XLIFF file formats using C# and .Net technologies

查看:114
本文介绍了如何使用C#和.Net技术编辑XLIFF文件格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何人都可以帮我如何做到这一点吗,甚至任何示例,或者
链接将不胜感激.
我在Google中搜索,但未找到与此相关的任何文章.

该工具应该能够执行以下操作:

*打开现有的XLIFF文件
*保存修改后的XLIFF文件
*显示ID(只读)
*显示未翻译的文本(只读)
*显示和编辑翻译后的文本(读/写)
o更改文本应自动将状态更改为
翻译
*显示和编辑翻译状态为布尔值(is
翻译–读/写). XLIFF支持多种状态;这个工具
只关心翻译和需求翻译.
*允许通过过滤显示的数据(将进行过滤
单击应用过滤器"按钮时):
o ID
o未翻译的文本子字符串
o翻译文本子字符串
o过滤后的状态

can any one please help me how to do this one even any example or
links to do will be appreciated .
i searching in googles and not found any article about this .

The tool should be able to perform the following:

* Open an existing XLIFF file
* Save the modified XLIFF file
* Display the Id (read only)
* Display the un-translated text (read only)
* Display and edit the translated text (read/write)
o Changing the text should automatically change the state to
translated
* Display and edit the translation state as a Boolean (is
translated – read/write). XLIFF supports multiple states; this tool
only cares about translated and needs-translation.
* Allow filtering the displayed data by (filtering will take place
when the Apply Filters buttons is clicked):
o Id
o Un-translated text sub-string
o Translated text sub-string
o Filtered state

推荐答案

loger21问了一个后续问题:
loger21 asked a follow-up question:

我的问题是,如何使用C#加载XLIFF文件? [标点/语法固定— SA]

My question is, how to load XLIFF files using C#? [Punctuation/grammar fixed — SA]

该XLIFF文件应该是格式正确的XML.如果您遵循我在解决方案2中介绍的第一种方法,则可以基于一个可用的.NET XML解析器编写XLIFF解析器.这是我对它们的简短概述:

The XLIFF file is supposed to be a well-formed XML. If you follow the first approach I explain in my Solution 2, you can write a XLIFF parser based on one of available .NET XML parsers. Here is my short overview of them:


  1. 使用System.Xml.XmlDocument类.它实现了DOM接口;如果文档太大,则这种方法最简单,也足够好.
    请参见
  2. 使用类System.Xml.XmlTextReader; library/system.xml.xmldocument.aspx"target =" _ blank"title =" New Window> ^ ].
  3. 使用类System.Xml.XmlTextReader;这是最快的读取方法,尤其是您需要跳过一些数据.
    请参见 http://msdn.microsoft.com/en-us/library/system.xml.xmlreader.aspx [ http://msdn.microsoft.com/en-us/library/system.xml.xmldocument.aspx [http://msdn.microsoft.com/en-us/library/bb387063.aspx [

  1. Use System.Xml.XmlDocument class. It implements DOM interface; this way is the easiest and good enough if the size if the document is not too big.
    See http://msdn.microsoft.com/en-us/library/system.xml.xmldocument.aspx[^].
  2. Use the class System.Xml.XmlTextReader; this is the fastest way of reading, especially is you need to skip some data.
    See http://msdn.microsoft.com/en-us/library/system.xml.xmlreader.aspx[^].
  3. Use the class System.Xml.Linq.XDocument; this is the most adequate way similar to that of XmlDocument, supporting LINQ to XML Programming.
    See http://msdn.microsoft.com/en-us/library/system.xml.xmldocument.aspx[^], http://msdn.microsoft.com/en-us/library/bb387063.aspx[^].



—SA



—SA


请参阅我对这个问题的评论,在这里我解释了为什么您不希望在这个特定主题上获得太多帮助.但这仅仅是因为您确实不需要特定主题方面的帮助.寻求这种帮助没有任何意义.你知道为什么?因为您缺少编程的主要功能之一(这与科学的主要特征相似):您学习通用的基本技术,而不是特定的应用程序主题,但是可以帮助您在许多不同的应用程序领域中设计软件.

因此,如果您需要帮助,可能会对软件工程有所帮助:方法,平台,语言和技术.这些步骤将是:设计数据结构,库和应用程序,并实现所有这些.

您可以尝试考虑两种方法.首先是制作您自己的仅CLR框架;另一个将使用某种本机代码框架(请尝试从
http://en.wikipedia.org/wiki/XLIFF [ ^ ]),然后通过P/调用:
http://en.wikipedia.org/wiki/P/Invoke [ http://msdn.microsoft.com/en-us/library/Aa712982 [ ^ ].

此CodeProject也可能有用:基本P/调用 [ http://en.wikipedia.org/wiki/C%2B%2B/CLI [ ^ ],
http://www.ecma-international.org/publications/standards/Ecma-372.htm [^ ],
http://msdn.microsoft.com/en-us/library/xey702bw.aspx [ ^ ],
http://msdn.microsoft.com/en-us/library/3bstk3k5 [ ^ ].

但是我们不知道您当前的弱点.除了一个:可能,您害怕独立工作.我没有找到任何.NET LIFF框架,因此您可能也一无所知.而且,如果没有一些外部帮助,您没有足够的勇气来开始自己的事业.上面我已经解释了为什么在您的情况下不太可能获得大量帮助.现在,我可以尝试为您提供一个理由,如果您具有足够或几乎足够的知识并且对结果真的感兴趣,那么它可能是最适合您工作的原因:您可以获得宝贵的经验.此外,您将进入一个可以从CodeProject(或其他)专家那里获得有效帮助的职位,因为您将能够显示一些有问题的代码.

这样的经验可以帮助您获得更多帮助的另一个重要原因是:您可以在解决问题上吃了苦头之后,就能够更好地理解建议.

想一想.

—SA
Please see my comment to the question where I explain why you should not expect much help on this particular topic. But this is just because you don''t really need help in a particular topic. Asking for such help does not make a lot of sense. You know why? Because you are missing one of the main features of programming (which is similar to a main trait of the science): you learn general fundamental technologies, not particular application topics, but that helps you to engineer software in many different application fields.

So, if you might need some help, you could be some help in software engineering: approached, platform, languages and techniques. The steps will be: design data structure, the library and the applications, and implement all that.

There are two approaches you could try to consider. First would be making your own CLR-only framework; and another one would be using some native-code framework (try to find one starting from http://en.wikipedia.org/wiki/XLIFF[^]) and using it through P/Invoke:
http://en.wikipedia.org/wiki/P/Invoke[^],
http://msdn.microsoft.com/en-us/library/Aa712982[^].

This CodeProject can also be useful: Essential P/Invoke[^].

One alternative to P/Invoke is to use C++/CLI mixed-mode (managed+unmanaged) project. This project could build a DLL required by the global hooks, but it can contain some managed wrapper CLI code, so, from the standpoint of your .NET application, you can use it as a regular .NET assembly, that is, reference it. Please see:
http://en.wikipedia.org/wiki/C%2B%2B/CLI[^],
http://www.ecma-international.org/publications/standards/Ecma-372.htm[^],
http://msdn.microsoft.com/en-us/library/xey702bw.aspx[^],
http://msdn.microsoft.com/en-us/library/3bstk3k5[^].

But we don''t know your current weaknesses. Except one: probably, you are afraid to get to work independently. I did not find any .NET LIFF frameworks, so you probably also don''t know any. And you don''t have enough bravery to start your own without some external help. I explained above why getting a lot of help is not likely in your case. Now, I can try to offer you a reason why it could be the best for you to get to work, if you have enough or almost enough of knowledge and you are really interested in the result: you can get valuable experience. Besides, you will advance you into a position where you would be able to get effective help from CodeProject (or other) experts, because you would be able to show some problematic code.

There is one more important reason why such experience would help you to get more help: you would be able, after breaking some teeth against the problems, to understand the advice much better.

Just think about it.

—SA


似乎可以使用.NET中的存在库来完成.在这里看看:
http://stackoverflow.com/questions/5475167/reading-editing-xliff-using- c-sharp [ ^ ]
Seems this could be done using the existion librarys in .NET. Take a look here:
http://stackoverflow.com/questions/5475167/reading-editing-xliff-using-c-sharp[^]


这篇关于如何使用C#和.Net技术编辑XLIFF文件格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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