Articy Localization Importer improvements
Posted: Sun Mar 10, 2024 6:49 am
Hi again,
Last month I tried the articy localization plugin of the Dialogue System, it works very well!
I'd like to talk about some adjustments to improve it, if you're open to it
In the script ArticyLocalizationImporter.cs :
1/ In the function ProcessExcelFile(string languageCode, string filename), there is this loop:
I replaced this part:
...by this:
The reason: maybe I missed something but in my localization excel file the locaID looks like this:
TechnicalName.TemplateName.Property
As an example, for a character's name:
PoliceNetworkManager.Character_Base_Properties.CharacterName
Without the code change, the importer is looking for a field called "Character_Base_Properties.CharacterName", when it should, in my opinion, search for a field called "CharacterName". I think it's the way it works in the main xml import.
2/ In the same function, I had to add this check:
Can't understand why, but after some modifications in the localized file (like suppressing some useless lines to make the document more readable by the translator), I always have a null ref exception on import for the last line of my document: row.Value and locaID are null.
If you have no idea why it does that, I'll try to find out exactly when the error starts to appear.
3/ Finally, in the function "SetFieldInFieldsList(List<Field> fields, string title, string value)", I added this line:
With the regular main xml import, in the ArticyConverter script, dialogue lines are always parsed this way to preserve line breaks. Without this, formatting is different between localized and original texts. I guess it's just a mere oversight...
That's all
Marc
Last month I tried the articy localization plugin of the Dialogue System, it works very well!
I'd like to talk about some adjustments to improve it, if you're open to it
In the script ArticyLocalizationImporter.cs :
1/ In the function ProcessExcelFile(string languageCode, string filename), there is this loop:
Code: Select all
for (int i = 0; i < rows.Length; i++)
{
var row = rows[i];
var locaID = row.LocaID;
var value = row.Value;
var contextPath = row.ContextPath;
var dotPos = locaID.IndexOf('.');
var technicalName = locaID.Substring(0, dotPos);
var fieldSpec = locaID.Substring(dotPos + 1);
if (contextPath.StartsWith("Assets")) continue;
SetLocalizedField(languageCode, technicalName, fieldSpec, value);
}
Code: Select all
var dotPos = locaID.IndexOf('.');
var technicalName = locaID.Substring(0, dotPos);
var fieldSpec = locaID.Substring(dotPos + 1);
Code: Select all
string[] split = locaID.Split('.');
string technicalName = split[0];
string fieldSpec = split[split.Length - 1];
TechnicalName.TemplateName.Property
As an example, for a character's name:
PoliceNetworkManager.Character_Base_Properties.CharacterName
Without the code change, the importer is looking for a field called "Character_Base_Properties.CharacterName", when it should, in my opinion, search for a field called "CharacterName". I think it's the way it works in the main xml import.
2/ In the same function, I had to add this check:
Code: Select all
if (locaID == null) continue;
If you have no idea why it does that, I'll try to find out exactly when the error starts to appear.
3/ Finally, in the function "SetFieldInFieldsList(List<Field> fields, string title, string value)", I added this line:
Code: Select all
if (value.Contains(@"\n")) value = value.Replace(@"\n", "\n");
That's all
Marc