-
Notifications
You must be signed in to change notification settings - Fork 160
Discussion: Localize code comments #2515
Comments
How to use anonymous pipes for local interprocess communication I'd love to read this in german :) |
https://docs.microsoft.com/en-us/aspnet/core/fundamentals/localization?view=aspnetcore-3.1 |
@RiadKatby Thank you for your feedback. We currently do not localize this content into Arabic, but will keep your feedback in mind for future consideration. |
I would like that comments were in Brazilian Portuguese! |
https://docs.microsoft.com/zh-CN/dotnet/standard/io/memory-mapped-files I'd love to read this in Chinese |
My opinion may not be PC, but does this make sense anyway? Many of the documentation pages are automatically (and, thus, often wrong) translated. So, is this question about having comments automatically translated, too? How about text in code then (e.g. |
I share SetTrend's concern, does it make any sense to provide code comments in anything other than English? Most developers I know prefer to let the code speak for itself, so rather than adding a comment they would try to re-write the code in a way that makes its intent clearer. Accordingly there is an argument that code comments should be added only as a last resort to explain something that is truly complex from which it follows that the comment itself is unlikely to be trivial. Translating such comments into other languages is likely to be a challenging task that will be difficult to automate, so I suspect a team of people will be needed who are a) knowledgeable enough technically to understand the comment in the context of the code b) knowledgeable enough about both languages to provide a fair translation. In fact it could be argued that only the author of the code should write the comment in the first place. Therefore perhaps the real question is whether or not we should encourage programmers to write comments in their mother tongue? That raises its own problems. What would people feel about code comments written in Welsh, say? My view is that writing comments in anything other than English makes the code accessible to far fewer people. The world of scientific publications has a similar issues. If you want your paper to be widely read and cited, then it has to be written in English. This is certainly unfair to people whose mother tongue isn't English, but is the price we must pay for being able to disseminate knowledge globally. I urge caution before embarking on a project to provide code comments in languages other than English as there is a danger that the result would be an unintelligible mess that was useful to nobody, particularly in the case of files edited by multiple developers. |
Although i'm from germany i prefer to read comments in English. The same goes for help in general. |
@SetTrend and @wpqs we're looking for comments from non english speakers.
Only code comments would be localized.
It's automated, just as the majority of the documents are machine translated.
Why is that, the /en.en/ version has the doc in the original english and the comments in the original english. All the english text is translated in a doc, why do you think it will make the doc worse to also translate the code comments? @wpqs Please rewrite the following snippets so comments aren't beneficial |
A colleague in Germany tells me he first reads the German version, and if it's not clear he reads the /en.en/ version. So you lose nothing by comments localized.
We have two mechanisms to prevent technical terms from being localized. An issue should be opened when that's not the case.
You have the option to drop back to /en.en/, most folks don't have that option. |
@Rick-Anderson : I'm German, too. (Please refer to my GitHub profile). I humbly take this as a compliment 😉 Here's just one example of a hard-to-understand translation:Original English Version
Translated German Version (hard to grasp)
English Version, Translated From German (utilizing Bing)
The following doesn't make sense in German:The heading text in the screenshot reads: "The preceding command displays the following dialog:" But, no, it doesn't "display the following dialog". Because with a German Windows installation (which German users, like me, will most likely use) it'll rather resemble this: May I ask what you expect to be the benefit from only translating code comments?Currently, I don't see any benefit from using German comments but English variable names, like in this UWP example (try to relate the comments to the code): Compositor _compositor;
ContainerVisual _container;
SpriteVisual _colorVisual1, _colorVisual2;
CompositionColorBrush _blackBrush, _greenBrush;
// Quadrat mit Hilfe eines zusammengesetzten Pinsels erstellen
_compositor = Window.Current.Compositor;
_container = _compositor.CreateContainerVisual();
// Ersten Farbpinsel in der Farbe schwarz erstellen
_blackBrush = _compositor.CreateColorBrush(Colors.Black);
_colorVisual1= _compositor.CreateSpriteVisual();
_colorVisual1.Brush = _blackBrush;
_colorVisual1.Size = new Vector2(156, 156);
_colorVisual1.Offset = new Vector3(0, 0, 0);
_container.Children.InsertAtBottom(_colorVisual1);
// Zweiten, kleineren Farbpinsel in der Farbe grün erstellen und in der Mitte zentrieren
_ greenBrush = _compositor.CreateColorBrush(Color.FromArgb(0xff, 0x9A, 0xCD, 0x32));
_colorVisual2 = _compositor.CreateSpriteVisual();
_colorVisual2.Brush = _greenBrush;
_colorVisual2.Size = new Vector2(150, 150);
_colorVisual2.Offset = new Vector3(3, 3, 0);
_container.Children.InsertAtBottom(_colorVisual2); I tend to consent to @EpsilonBoo's comment: For foreign readers it's impossible to relate native comments to English variable names, literal texts or similar. |
@SetTrend you don't see any code comments that could be beneficial to non-native speakers? |
You see, all the different .NET class names, fields, properties, methods, variable names - and, basically, all technical terms are commonly given in English. If someone wouldn't be able to tell the meaning of Let me give a 排序 _排序;
容器视觉 _容器;
雪碧视觉 _颜色视觉1, _颜色视觉2;
组合颜色刷 _黑刷, _格林布什;
// Create square using composition color brushes
_排序 = 窗口.当前.排序;
_容器 = _排序.创建容器视觉();
// Create first color brush using a black square shape
_黑刷 = _排序.创建颜色刷(颜色.黑);
_颜色视觉1= _排序.创建特权视觉();
_颜色视觉1.刷 = _黑刷;
_颜色视觉1.大小 = 新增功能 向量2(156, 156);
_颜色视觉1.抵消 = 新增功能 向量3(0, 0, 0);
_容器.孩子.插入底部(_颜色视觉1);
// Create second color brush using a smaller green square shape and center it within first color brush
_格林布什 = _排序.创建颜色刷(颜色.从颜色(0xff, 0x9A, 0xCD, 0x32));
_颜色视觉2 = _排序.创建特权视觉();
_颜色视觉2.刷 = _格林布什;
_颜色视觉2.大小 = 新增功能 向量2(150, 150);
_颜色视觉2.抵消 = 新增功能 向量3(3, 3, 0);
_容器.孩子.插入底部(_颜色视觉2); As you can see from my example, localizing only the comments doesn't help in understanding the code. So, from my perspective, the reader either knows a fair amount of the English language or he/she is lost anyway. I believe it's perfectly alright to provide localized documentation (given it'd be correct and not as tainted as it currently is) to give native readers a thorough understanding of a topic. Hoever, when it comes to coding, a small set of English speaking knowledge is inevitable. Actually, back in the past, when I gave programming courses, I used German class and variable names for the learner to be able to easily tell (English) framework classes, typedefs etc. from my (German) proprietary example terms. Today, when I create examples, I prefix all my classes, typedefs, events etc. with "My", so the reader can immediately distinguish my types (which she doesn't need to remember) from types provided by the framework (which she needs to learn and remember). |
@SetTrend Please rewrite the following snippets so comments aren't beneficial https://docs.microsoft.com/en-us/dotnet/standard/io/pipelines I've been told by several localized comments would be beneficial.
All those items would not be localized
that's not our experience |
I think it is ok to localize help items and code comments. |
When I follow the hyperlink you suggested, I get a 404 File Not Found error, I'm afraid.
Did these people explain why localized comments would be beneficial? I feel the "why" is the important part to know here, to then derive particular conclusions from.
Exactly. If the (localized) documentation itself wasn't conclusive enough to clarify the purpose of (English) class names and objects, then why should an example be? It's not the purpose of examples to add further information to documentation. The purpose of examples is to reflect in the shortest possible manner what's been described in the documentation, so the reader get's a first feeling of the class and won't feel alone when for the first time trying to implement what's been described in the documentation.
If your experience is different, I'll gladly refrain from my position. However, how can comments alone be helpful when string literals, conveying the result of an example, won't be translated, too? I'm currently reading through the UWP documentation. Here's an example of C# code with string literals which, when executed, reflect the status of an adaptive audio input stream. The string literals merely reword the status enum. Would you be striving for adding a localized comment for foreign readers to each of the status cases to finally clarify what's happening (which is the exact purpose of the string literals in the example)? Fine observation. Yet, it's not only the half-baked translation of technical terms (in German we don't have this kind of technical term. Moreover, "Injektion" is Latin, not German. A rather more correct translation into German would be "Das Einbringen von Abhängigkeiten", which is three words instead of two in English, still easy to grasp/read. [We Germans tend to prefer "verb derived noun of attribute" over "attribute _ verb derived noun" which, in contrast, English speakers prefer.]) In my example I was rather referring to misleading/wrong translations:
|
Nice article. You requested me to survey the above page for a necessity of localizing comments. So these are my (personal) remarks on first sight (sorted by reading sequence order):
I'll stop my observation here. Hope this is of any help to you. Looking forward to your thoughts. |
If it is going to be machine translated, that would be more harm than good. In my experience at least, it is horrific at translating Turkish and overcomplicates articles. |
Most of the time, I have a result in my native language and the original in english : I understand better the english version. The translated article is so bad that I don't understand it... |
While this might be useful to a beginner (school students learning .NET), it's worth doing only if Microsoft has the resources and qualified people for such a translation. Otherwise, any developer with a little experience already knows English well enough. |
https://docs.microsoft.com/es-es/aspnet/core/data/ef-rp/update-related-data?view=aspnetcore-5.0 |
It is in Spanish, via the |
I'd love to read this in Persian :) |
Hebrew and Ukrainian, please |
Auto translated pages are so bad I can't understand them even when I face a totally new API/technology/etc. I had no idea what it's talking about. Some weeks ago I installed FFS MSDN in English to disallow this stupid forced auto translator, since no matter how many times I changed my settings, it always reenabled auto translations. |
I think so. |
As non-native speaker, I am of the same opinion as @SetTrend - I never read any documentation in other language than English - especially any automated translation is of poor quality. Like it or not, any software developer must know English - this is normal. |
Please, add the russian localization |
Why write that the documentation comes from .net 6 if the code examples have features that are specific to .net 5 and below? |
I'd love to read this in Persian :) |
it would be great if it be available in persian / farsi |
It would be very confusing. Take a look at https://docs.microsoft.com/en-us/dotnet/standard/io/memory-mapped-files
The translation of just a comment thus reduces its usefulness. It would be very useful to have some visible button to switch back to the original language. I am constantly rewriting |
Great suggestion. Please open an issue for that. |
This comment was marked as outdated.
This comment was marked as outdated.
@MSDN-WhiteKnight wrote
Right, that's why he's asking for a button to go from English back to the original language after clicking that icon. @j123b567 wrote:
|
Please, add the Pashto language/localization |
I'd love to read this in Ukrainian :) |
I'm trying to read all of Microsoft's documentation using the translator. I wish all document comments were in Turkish. |
Leave a comment here if you would like to have code comments in your native language. Include a link to the document that includes code with English only comments.
THIS IS NOT AN ISSUE TO ADD NEW LANGUAGES, IT'S TO LOCALIZE THE CODE COMMENTS WITHIN THE CODE IN ADDITION TO THE DOCUMENT.
The text was updated successfully, but these errors were encountered: