After upgrading to version 2.4.6 to fix nested content mapping issues, the xliff provider fails when the format is set to xliff 1.2.
When uploaded a translated file, the UI returns an error with the message "Cannot Load: cannot find xliff file"
The process works fine when set to Xliff 2, however our clients translation provider requires files in xliff 1.2 format.
After browsing the decompiled source code, there appears to be a bug in SimpleFile.XliffProvider, in the method LoadJobFromFile:
public TranslationAttempt<TranslationJob> LoadJobFromFile(string filepath, TranslationJob job, bool blankTarget)
{
SimpleFileIO simpleFileIo = new SimpleFileIO(this.folder);
this.logger.Debug<XliffProvider>("File Location: {0}", (Func<object>) (() => (object) filepath));
SimpleProviderOptions properties = this.GetProperties(job.ProviderProperties);
properties.uploadedFile = filepath;
try
{
if (properties.format.InvariantEquals("xliff2"))
{
using (Stream fileStream = simpleFileIo.ReadFile(filepath))
{
TranslationAttempt<TranslationJob> translationAttempt = new Xliff20Serializer().Deserialize(new Xliff20IOHelper().ReadFromStream(fileStream), job, blankTarget, true);
if (translationAttempt.Success)
{
translationAttempt.Result.ProviderProperties = JsonConvert.SerializeObject((object) properties);
return TranslationAttempt<TranslationJob>.Succeed(translationAttempt.Result);
}
}
}
else
{
Xliff12IOHelper xliff12IoHelper = new Xliff12IOHelper();
using (simpleFileIo.ReadFile(filepath))
{
TranslationAttempt<TranslationJob> translationAttempt = new Xliff12Serializer(this.logger).Deserialize(xliff12IoHelper.LoadFromFile(filepath), job, false, true);
if (!(bool) translationAttempt)
return TranslationAttempt<TranslationJob>.Fail(translationAttempt.Message);
translationAttempt.Result.ProviderProperties = JsonConvert.SerializeObject((object) properties);
return TranslationAttempt<TranslationJob>.Succeed(translationAttempt.Result);
}
}
}
catch (Exception ex)
{
return TranslationAttempt<TranslationJob>.Fail("Cannot Load : " + ex.Message);
}
return TranslationAttempt<TranslationJob>.Fail("Unable to Load File for Job");
}
The code that runs when the file is in xliff 1.2 format seems to incorrectly load the file from a path instead of a stream, as is the case for loading xliff 2 files.
xliff 1.2 issue
Hi,
After upgrading to version 2.4.6 to fix nested content mapping issues, the xliff provider fails when the format is set to xliff 1.2.
When uploaded a translated file, the UI returns an error with the message "Cannot Load: cannot find xliff file" The process works fine when set to Xliff 2, however our clients translation provider requires files in xliff 1.2 format.
After browsing the decompiled source code, there appears to be a bug in SimpleFile.XliffProvider, in the method LoadJobFromFile:
The code that runs when the file is in xliff 1.2 format seems to incorrectly load the file from a path instead of a stream, as is the case for loading xliff 2 files.
Any help would be appreciated, Thanks!
Hi Stephen,
Yes good spot, not sure why it does that, but it's fixed now:
You should only need to upgrade the Xliff package:
(https://www.nuget.org/packages/Jumoo.TranslationManager.Providers.Xliff/2.3.7)
Great, thanks for the speedy response Kevin
is working on a reply...