Forum rules - please read before posting.

[ISSUE] Error on exporting *sorted* strings for localisation

Hi there!

It's been there sitting for a while, but I thought it was a temporary issue.

Maybe I'm doing something wrong?

Here's the error:

Could you please investigate a bit on this?

I can still export everything without sorting, but I can't use sorting.

(having multiple sort criteria, custom delimiter char, or exporting/importing all languages in/from a single file would be cool)

Thanks

Comments

  • I can't reproduce such an error. What's your Unity version?

    PM me your Speech Manager asset file and I'll take a look.

    It is already possible to import and export languages from a single file - add new columns in the Export Wizard window to export multiple languages.

  • Hi Chris, I'm using Unity 2019.2.9f1.

    I will try to send you the required info asap.
    Apologies, I'm currently in the deadline day, and I'm a bit panicking.

  • Whether this is causing the error message or not, I'm not sure, but there is a typo in ExportWizardWindow.cs. Line 382 should read as follows:

    exportLines.Sort (delegate (SpeechLine a, SpeechLine b) {return a.scene.CompareTo (b.scene);});
    

    If that still produces an error, what is the result of replacing it with:

    exportLines.Sort((x, y) => string.Compare(x.scene, y.scene));
    
  • edited October 2019

    You're right, my line was:

    exportLines.Sort (delegate (SpeechLine a, SpeechLine b) {return a.scene.CompareTo (b.owner);});

    not b.scene

    btw, JetBrains Rider is suggesting me to replace the new line (and a few of the above sort cases) with

    exportLines.Sort ((a, b) => String.Compare(a.scene, b.scene, StringComparison.Ordinal));

    saying that Compare is culture specific, not sure if it's really necessary or not.

    here's the full list of changes it's suggesting - I saw you recently replaced several if cascades with switch constructs, so maybe could be useful. Not trying to be bold! Apologies if you perceived it as rude, that was not the intention:

    `

        if (doRowSorting)
            {
                switch (rowSorting)
                {
                    case RowSorting.ByID:
                        exportLines.Sort ((a, b) => a.lineID.CompareTo(b.lineID));
                        break;
                    case RowSorting.ByDescription:
                        exportLines.Sort ((a, b) => String.Compare(a.description, b.description, StringComparison.Ordinal));
                        break;
                    case RowSorting.ByType:
                        exportLines.Sort ((a, b) => String.Compare(a.textType.ToString(), b.textType.ToString(), StringComparison.Ordinal));
                        break;
                    case RowSorting.ByAssociatedObject:
                        exportLines.Sort ((a, b) => String.Compare(a.owner, b.owner, StringComparison.Ordinal));
                        break;
                    case RowSorting.ByScene:
                        //exportLines.Sort (delegate (SpeechLine a, SpeechLine b) {return a.scene.CompareTo (b.owner);});
    
                        exportLines.Sort ((a, b) => String.Compare(a.scene, b.scene, StringComparison.Ordinal));
                        break;
                    default:
                        throw new ArgumentOutOfRangeException();
                }
            }`
    

    I tested your quick fix and it's working like a charm!

    Even the snipped I posted above is working.

    Thanks for the quick fix! :)

    (feat req: add multiple sorting criteria)

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.