Ludeon Forums

Ludeon Forums

  • December 18, 2018, 06:54:33 PM
  • Welcome, Guest
Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Tooltip and main description template strings are not localizable  (Read 302 times)

Elevator

  • Drifter
  • **
  • Posts: 65
  • Refugee
    • View Profile

A lot of strings are hard-composed in the game code, which is not convenient for localization to other languages. For example, here is the code for tooltip generation:

Code: [Select]
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.Append(this.LabelCap);
string text = string.Empty;
if (this.gender != Gender.None)
{
text = this.gender.GetLabel();
}
if (!this.LabelCap.EqualsIgnoreCase(this.KindLabel))
{
if (text != string.Empty)
{
text += " ";
}
text += this.KindLabel;
}
if (text != string.Empty)
{
stringBuilder.Append(" (" + text + ")");
}
stringBuilder.AppendLine();
if (this.equipment != null && this.equipment.Primary != null)
{
stringBuilder.AppendLine(this.equipment.Primary.LabelCap);
}

The order of words is fixed, and nobody except developers can change it.
If there was a possibility to use template lines from localization, all the entries could be translated accurately.
« Last Edit: December 23, 2017, 08:11:19 AM by Elevator »
Logged

Tynan

  • Developer
  • Administrator
  • Transcendent
  • *****
  • Posts: 11513
    • View Profile
    • Tynan's Blog
Re: Tooltip and main description template strings are not localizable
« Reply #1 on: September 14, 2018, 03:35:56 AM »

bump
Logged
Tynan Sylvester - @TynanSylvester - Tynan's Blog

Elevator

  • Drifter
  • **
  • Posts: 65
  • Refugee
    • View Profile
Re: Tooltip and main description template strings are not localizable
« Reply #2 on: November 12, 2018, 10:10:48 AM »

The issue is still actual. I can provide a list of places in code that make translation difficult.
Logged

Kenneth

  • Developer
  • Colonist
  • *****
  • Posts: 243
  • Refugee
    • View Profile
Re: Tooltip and main description template strings are not localizable
« Reply #3 on: November 30, 2018, 10:32:47 AM »

I fixed the one thing you mentioned in your first post. Thanks for reporting! ;)

If you're up to providing more infos for issues like this, please give us a list of methods that require changing (in the classname.methodname notation, so for example "Pawn.GetTooltip" - this makes it easier for us to find the place you're referring to as the disassembled code doesn't necessarily look like our original).
Logged

Elevator

  • Drifter
  • **
  • Posts: 65
  • Refugee
    • View Profile
Re: Tooltip and main description template strings are not localizable
« Reply #4 on: December 01, 2018, 09:01:11 AM »

I had a conversation with another developer, Piotr (ison), about such places with formatting issues. I have listed several cases:
  • HealthCardUtility.DrawOverviewTab(). The line is: "text = text + pawn.def.label + ", " + "AgeIndicator".Translate(pawn.ageTracker.AgeNumberString);")
  • Tradeable_Pawn.Label (getter)
  • Pawn.GetTooltip() (mentioned here)
  • IncidentWorker_PsychicDrone.DoConditionAndLetter()
  • Hediff_Injury.LabelInBrackets (getter)
This list is not complete. Potentially every string concatenation operation can cause translation issues. My suggestion was to move such lines to Keyed translation as template strings. Ison's argument was that in this case it will be easy for translators to make a mistake. I partially agree with that position, but nevertheless it would be much better for translation if at least templates for punctuationless phrases (e.g. "bear paw" or "male human") were localizable.
« Last Edit: December 01, 2018, 09:02:54 AM by Elevator »
Logged

Elevator

  • Drifter
  • **
  • Posts: 65
  • Refugee
    • View Profile
Re: Tooltip and main description template strings are not localizable
« Reply #5 on: December 02, 2018, 05:20:33 PM »

CompNeurotrainer.TransformLabel() also generates an incorrect phrase in Russian.
Logged

ison

  • Developer
  • Planetologist
  • *****
  • Posts: 2136
    • View Profile
Re: Tooltip and main description template strings are not localizable
« Reply #6 on: December 06, 2018, 07:59:20 AM »

Moved to mantis along with other translation issues: https://ludeon.com/mantis/view.php?id=3630
Logged