Support forum of the software localization tool Sisulizer


Localization Tool for VB, Delphi, .NET, C#, VB.NET, XML, Online Help, HTML ... Home

Get in contact with the makers of Sisulizer.
Our forum is open for all questions around Sisulizer from customers and prospects.
Don't hesitate to register and ask. The Sisulizer team will answer ASAP.

Search     Help Home Sisulizer Website Download
Search by username
Not logged in - Login | Register 

 Moderated by: Renate.Reinartz, Markus.Kreisel, Jaakko.Salmenius, Ilkka.Salmenius
New Topic Reply Printer Friendly
embedded xml-files - Wish list for software localization tool - Technical Support (You need to be registered at the forum to write) - Localization Tool for VB, Delphi, .NET, C#, VB.NET, XML, Online Help, HTML ...
AuthorPost
 Posted: Thu Aug 23rd, 2007 06:04 pm
PM Quote Reply
andreas
Member
 

Joined: Sun Jul 1st, 2007
Location:  
Posts: 1
Status: 
Offline
Hello,

I have an xml-file that is an embedded resource in a .NET assembly. I want to translate this resource (by using Sisulizer)  and I also want to have it embedded into the generated satellite assemblies. Is that possible?

Regards

Andreas Sörenby

Last edited on Thu Aug 23rd, 2007 06:04 pm by andreas

Back To Top PM Quote Reply

 Posted: Fri Aug 24th, 2007 12:42 am
PM Quote Reply
Jaakko.Salmenius
Administrator


Joined: Sat Apr 8th, 2006
Location: Tokyo, Japan
Posts: 1641
Status: 
Offline
It is possible but currently it is a bit complicated. You have to add two sources to a Sisulizer project.

First source is the .NET project. Sisulizer shows the XML resource as one single text. You can translate it manually but it is very error prone. It is better that you add another source. The XML file itself and you use Sisulizer's XML localization to tranlate it. Then you add the data of the localized XML file to the .NET projects's cell. See the picture. Finalyl you build your project again. Now The resource contains the same data as the localized XML file.

In the near future we will add XML scaning to .NET scanner so you do not have to do these steps any more but Sisulizer will handle the XML resource as a XML data and uses XML editor for that.

Jaakko

Attachment: untitled.PNG (Downloaded 47 times)



____________________
http://www.sisulizer.com - Three simple steps to localize
Back To Top PM Quote Reply

 Posted: Sun Sep 16th, 2007 02:38 am
PM Quote Reply
Jaakko.Salmenius
Administrator


Joined: Sat Apr 8th, 2006
Location: Tokyo, Japan
Posts: 1641
Status: 
Offline
1.6.7 has this feature. you can download it

http://www.sisulizer.com/downloads.shtml

Jaakko



____________________
http://www.sisulizer.com - Three simple steps to localize
Back To Top PM Quote Reply

 Posted: Wed Oct 10th, 2007 12:06 pm
PM Quote Reply
bennison
Member
 

Joined: Wed Oct 10th, 2007
Location: Malmö, Sweden
Posts: 5
Status: 
Offline
I have an embedded XML file in my C#-project, but Sisulizer does not recognize it (I am running 1.6.13).   Do I need to tag the XML-file somehow to ensure that Sisulizer includes it in the project?

Attached image is from an example project that I set up.

Regards,

Fredrik

Attachment: EmbeddedXMLExample.JPG (Downloaded 36 times)

Back To Top PM Quote Reply

 Posted: Fri Oct 12th, 2007 06:43 am
PM Quote Reply
Jaakko.Salmenius
Administrator


Joined: Sat Apr 8th, 2006
Location: Tokyo, Japan
Posts: 1641
Status: 
Offline
The current implementation works only when .resx data item contains XML data. In your case you have an XML file included to Visual Studion project. I am right?

Sisulizer can yet not localize those files. What kind of data your XML file contains and what is the purpose of it?

Jaakko



____________________
http://www.sisulizer.com - Three simple steps to localize
Back To Top PM Quote Reply

 Posted: Fri Oct 12th, 2007 06:45 am
PM Quote Reply
Jaakko.Salmenius
Administrator


Joined: Sat Apr 8th, 2006
Location: Tokyo, Japan
Posts: 1641
Status: 
Offline
It seems that you have added the XML file as an embedded resource. I will implement this.

Jaakko



____________________
http://www.sisulizer.com - Three simple steps to localize
Back To Top PM Quote Reply

 Posted: Fri Oct 12th, 2007 07:27 am
PM Quote Reply
bennison
Member
 

Joined: Wed Oct 10th, 2007
Location: Malmö, Sweden
Posts: 5
Status: 
Offline
Jaakko.Salmenius wrote: The current implementation works only when .resx data item contains XML data. In your case you have an XML file included to Visual Studion project. I am right?

Sisulizer can yet not localize those files. What kind of data your XML file contains and what is the purpose of it?

Jaakko


Yes, I have included the XML file to the VS2005-project as an embedded file.  The file contains information about the assembly, ie name of view class etc.

This information is then read by an executable that can dynamically load different views.  It uses the information to instantiate the view class and set up menu structure etc.  Certain texts in this setup needs to be translatable, such as menu choices and window titles.

Back To Top PM Quote Reply

 Posted: Fri Oct 12th, 2007 07:30 am
PM Quote Reply
Jaakko.Salmenius
Administrator


Joined: Sat Apr 8th, 2006
Location: Tokyo, Japan
Posts: 1641
Status: 
Offline
Thank you. I am implementing the feature now and it will be in 1.6.14 that will come out next week.

Jaakko



____________________
http://www.sisulizer.com - Three simple steps to localize
Back To Top PM Quote Reply

 Posted: Sun Oct 14th, 2007 04:01 am
PM Quote Reply
Jaakko.Salmenius
Administrator


Joined: Sat Apr 8th, 2006
Location: Tokyo, Japan
Posts: 1641
Status: 
Offline
Actually this feature is already in Sisulizer. By default Sisulizer threats XML data in the .resx file as plain text (just like in your screenshot). However you can make Sisulizer to scan the data as XML.

1) Right click the left side of the row (gray aread) and choose Set Format | XML
(see screenshot)

2) An XML dalog shows up and you can select the elements that you want to localize.

3) Press OK and Sisulizer promts for rescan. Press OK.

Now Sisulizer scans that element of .resx as XML instead of plain text.

Unfortunately there was a bug in the build process and localized .resx files did not contain translated XML elements. I fixed this in 1.6.14 that will come out in few days.

Jaakko

Attachment: untitled.PNG (Downloaded 26 times)



____________________
http://www.sisulizer.com - Three simple steps to localize
Back To Top PM Quote Reply

 Posted: Fri Oct 19th, 2007 03:04 pm
PM Quote Reply
bennison
Member
 

Joined: Wed Oct 10th, 2007
Location: Malmö, Sweden
Posts: 5
Status: 
Offline
My problem is that I don't have the XML that I want to localize as a string in a .resx-file, I have the XML-file "as-is" embedded into the project.  Sisulizer does not recognize my XML-file as a file that can be localized.

See screenshots.  The only localizable resource Sisulizer recognizes is the Form1.Text resource.

 

Attachment: sizu1.JPG (Downloaded 25 times)

Back To Top PM Quote Reply

 Posted: Mon Oct 22nd, 2007 03:57 am
PM Quote Reply
Jaakko.Salmenius
Administrator


Joined: Sat Apr 8th, 2006
Location: Tokyo, Japan
Posts: 1641
Status: 
Offline
OK. I got  this and I am working on it.

Jaakko



____________________
http://www.sisulizer.com - Three simple steps to localize
Back To Top PM Quote Reply

 Posted: Wed Oct 24th, 2007 03:43 am
PM Quote Reply
Jaakko.Salmenius
Administrator


Joined: Sat Apr 8th, 2006
Location: Tokyo, Japan
Posts: 1641
Status: 
Offline
I implemented scanning on plain XML resource (and also image and HTML resources) in 1.6.14.

Can you send me a piece of code that you use to access the resources. This help me to figure out what kind of name to give the localized XML file.

You can attached the code here or send it to me to

support (at) sisulizer.fi

Jaakko



____________________
http://www.sisulizer.com - Three simple steps to localize
Back To Top PM Quote Reply

 Posted: Wed Oct 24th, 2007 11:40 am
PM Quote Reply
bennison
Member
 

Joined: Wed Oct 10th, 2007
Location: Malmö, Sweden
Posts: 5
Status: 
Offline
Hi!

A little background: Most of the code we have for loading localized strings and reading this embedded XML-file that we use is written by a former colleague of mine that has since left our company.  I really haven't looked into how these things works before.

We have previously been using a home made translator written by the same colleague that handled embedded XML-files so I assumed that it was simple. 

What I have now found is that our previous translator created a fake .resx-file and embedded the XML-file into that in the satellite assembly.

Example:

File NG_LDS.xml is embedded into the project.  For the satellite assembly a resource file named NG_LDS.xml.resx is created with one entry called NG_LDS.xml containing the contents of the XML-file.

So the code for accessing the resource is something like this:

public string GetXMLResource(string xmlFile, string selectedUserCulture)
{

   string
fullName = string.Empty;
   System.Globalization.CultureInfo culture =
      new System.Globalization.CultureInfo(selectedUserCulture);


   System.Reflection.Assembly assembly = 
      System.Reflection.Assembly.GetEntryAssembly();


   // Find the full name of our XML file resource
   foreach
(string name in assembly.GetManifestResourceNames())
   if (0 <= name.IndexOf(xmlFile))
   {
      fullName = name;
      break;
   }


    System.Resources.ResourceManager rm =
       new System.Resources.ResourceManager(fullName, assembly);


   try
   {
     // Try to read the localized XML-file
      return (string)rm.GetObject(xmlFile, culture);
   }


   catch (Exception)
   {}


   // We couldn't read the localized XML-file
   // Fall back to the original stream
   Stream stream = assembly.GetManifestResourceStream(fullName);
   StreamReader sr = new StreamReader(stream);
   return sr.ReadToEnd();


}

I don't know if this is the correct way to do this...  I think that perhaps better would be to add the embedded resource with the same name in the satellite assembly and access it through something like:

  // More checks probably needed to see that we actually get a satellite assembly
  // and a valid stream.
  Stream stream = 
      assembly.GetSatelliteAssembly(culture).GetManifestResourceStream(fullName);  
   StreamReader sr = new StreamReader(stream);
   return sr.ReadToEnd();


I personally think this second approach is better and it also works with what happens if you embed both NG_LDS.xml and NG_LDS.en.xml in the C# project.  In this case the studio will create a satellite assembly in the en catalogue for you with an embedded file named "NG_LDS.xml".

In conclusion:

I think that if you could embed the localized XML file in the satellite assembly with the same name that it has in the main assembly that would be best.

 

Last edited on Wed Oct 24th, 2007 11:44 am by bennison

Back To Top PM Quote Reply

 Posted: Thu Oct 25th, 2007 01:06 am
PM Quote Reply
Jaakko.Salmenius
Administrator


Joined: Sat Apr 8th, 2006
Location: Tokyo, Japan
Posts: 1641
Status: 
Offline
bennison wrote: I think that if you could embed the localized XML file in the satellite assembly with the same name that it has in the main assembly that would be best. 

I agree. Basically there are two choices:

1) Use the same name as original

Sample.xml -> Sample.xml

2) Add language part to the name

Sample.xml -> Sample.fi.xml

This would use the same naming convention as .resx files.

I will implement the both. The default is to use the same name as the original (#1)

Jaakko



____________________
http://www.sisulizer.com - Three simple steps to localize
Back To Top PM Quote Reply

 Posted: Mon Oct 29th, 2007 09:46 am
PM Quote Reply
Jaakko.Salmenius
Administrator


Joined: Sat Apr 8th, 2006
Location: Tokyo, Japan
Posts: 1641
Status: 
Offline
Are you using binary localization (added EXE to SL project) or project localization (added .csproj). It seems that you use project localization. Good. I have now implemented localization of custom resources (XML, HTML and images) when using project localizations. I will implement support for binary localizaiton later this year.

Jaakko



____________________
http://www.sisulizer.com - Three simple steps to localize
Back To Top PM Quote Reply

 Posted: Mon Oct 29th, 2007 09:53 am
PM Quote Reply
bennison
Member
 

Joined: Wed Oct 10th, 2007
Location: Malmö, Sweden
Posts: 5
Status: 
Offline
Jaakko.Salmenius wrote: Are you using binary localization (added EXE to SL project) or project localization (added .csproj). It seems that you use project localization. Good. I have now implemented localization of custom resources (XML, HTML and images) when using project localizations. I will implement support for binary localizaiton later this year.

Jaakko


We are indeed using project localization.

 

Back To Top PM Quote Reply

Current time is 08:27 am  
Localization Tool for VB, Delphi, .NET, C#, VB.NET, XML, Online Help, HTML ... > Technical Support (You need to be registered at the forum to write) > Wish list for software localization tool > embedded xml-files



WowUltra 1.11 Copyright © 2007 by Jim Hale - Based on WowBB Copyright © 2003-2006 Aycan Gulez

Sisulizer software localization tool - Three simple steps to localize