How should I go about creating a multilingual text translation editor in VS 2010?
Asked Answered
I

1

8

Feature explained below is available in Microsoft Dynamics AX (formerly known as Axapta), an ERP application. However, my question is related to Visual Studio 2010 and MVC 3 application. Please find my questions after this feature explanation.

  1. Screenshot #1 shows a method written in X++ (language used in Microsoft Dynamics AX) using the MorphX editor. If I select a text within double quotes and right-click on them, I will get the options as shown in the screenshot. This is true if the text begins with an @ character and is a valid id found in the label file.
  2. If I click on the option Lookup Properties/Methods, a tool tip will appear showing the actual text associated with the selected label id. Here in this case the label id is @SYS67 and its associated label text is Transaction date. Refer screenshot #2.
  3. If I click on the option Lookup Label/Text, the label editor will appear with the label id pre-filtered along with other languages of choice at the bottom section of the editor. I can change the translation text in different languages using the editor. Refer screenshot #3.
  4. In Dynamics AX, the label texts are stored in text files with label id and separated by a tab. Label ids always begin with @ symbol. Here in the example shown @SYS is the group prefix and the given number is a sequential index. Refer screenshot #4 that displays text found in an en-us label file.

I understand that this is similar to Resource editor in Visual Studio where the translation text are stored in .resx files for each language. I would like to do something similar for an ASP.NET MVC 3 application using SQL Server database as the data store for the translation text.

Here are my questions:

  1. What would I need to create in Visual Studio 2010 to achieve this functionality so I can invoke the translation editor in the IDE? Would that be a plugin or extension?

  2. Would a similar resource provider be possible to do in an ASP.NET MVC application, where I can just specify the label id within double quotes and have provider model fetch the data from database during runtime? Is the syntax Resources.MyResource.GetLabel("@SYS67"); the only available option in ASP.NET? Sorry, if the resources syntax is wrong.

  3. Are there any similar tool set (plugin/extension) already available for Visual Studio?

  4. I believe that one of the terms to do translation in ASP.NET application is making use of Resource Provider Model. Are there any other terms? I am interested to know the term of what I am trying to achieve so I can search on the web to read more about it.

Any inputs will be really appreciated.

Thanks in advance.

Screenshot #1:

1

Screenshot #2:

2

Screenshot #3:

3

Screenshot #4:

4

Idiot answered 27/5, 2011 at 13:5 Comment(2)
Is there a reason why you absolutely need to build a tool similar to your screenshot instead of just using the built-in Resource way? Even for a tool like the one from MS Dynamic you will still have to pass inside each of your Views, while using Resource can offer other benefits than just translating "label", validation, images comes to mind.Molina
I understand what you mean, I'm from Quebec, Canada (we have two official languages here, so ML apps are common). I can see potential in having an extension in the IDE to view at one all translation. Though the time(money?) you will invest to build the tool, your entire app could be translated using the built-in Resource files. There nothing stopping you from building a web interface for users to modify those .resx, they are just plain xml file after all. This is my .2c ;) There's couple of open source Resource Editor already you can start from.Molina
A
1

I'm going to jump in here and give you what I know. I apologize if it doesn't completely answer your question but I don't want to stray too far from what I am familiar with and thus give you bad advice.

From the way you describe your issue, it seems that you could use the resource files (RESX) for translations, the issue is more that you want to know how to edit them in a manner that is user friendly. Further, some users may want to edit the translations on the web.

To answer this part of your question, I would recommend that you look at this article:

http://blog.lavablast.com/post/2008/02/07/RESX-file-Web-Editor.aspx

The author seems to have a similar issue as you and the conclusion the author arrived at was similar to what you are thinking about. The source code is provided so you could get a head-start if you wanted to pursue this method.

If you are going to pursue rolling your own editor, I would suggest that you choose one interface and stick with it. Otherwise you will be increasing your development time on something that isn't your actual product. Since you want the web for some users, I would suggest you would stick with the web for everyone. However, if you really want to pursue an plugin for Visual Studio, I would recommend that you put as much code into a central business logic layer as possible so that your presentation layers don't take up much of your time.

As for currently-available options, I don't think any of the following are Visual Studio plugins, but they all do a good job at working with localization:

If you want to learn more about the terminology and practices of localization, I would recommend the following site:

http://quickstarts.asp.net/QuickStartv20/aspnet/doc/localization/localization.aspx

If you want to store information in a database instead of a .resx file, here is a resource that will show you how to do it:

http://msdn.microsoft.com/en-us/library/aa905797.aspx

Au answered 5/6, 2011 at 0:27 Comment(1)
@Siva - you are correct about the application restart upon changes to the .resx file. I've updated my answer above to include information on how to use a database for localization.Au

© 2022 - 2024 — McMap. All rights reserved.