Skip to content

Conversation

@MattiaZir
Copy link
Contributor

@MattiaZir MattiaZir commented Dec 6, 2025

  • Replaced generic "Resource" with the actual class name (e.g. "Texture2D").
  • Used TTRN for correct pluralization support.
  • Removed unnecessary parentheses around the count.

This fixes #113310


if (num_of_copies > 1) {
tooltip = vformat(TTR("This Resource is used in (%d) places."), num_of_copies);
tooltip = vformat(TTRN("This %s is used in %d place.", "This %s is used in %d places.", num_of_copies), resource_name, num_of_copies);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could the first string be empty or something? There resource will never be used in only one place.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought about it but it might be better to leave it instead.
An empty string might break the template generation since "" is reserved for the PO file metadata in gettext if I remember correctly.

Worst case scenario, the first string never gets used.

What do you think?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's more a question to @timothyqiu

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resource_name is used to format strings for translation and is not translated itself. So whether it is empty has nothing to do with TTRN / PO. I believe you need to consider the possibility of it being empty because if it is empty, the resulting formatted string might look strange.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So if I understand correctly the first string ("This %s is used in %d place.") can be empty as @KoBeWi suggested?

Or do you mean that we should make sure that the variable resource is never empty since it could mess up the formatted string?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I thought you were referring to the first placeholder.

In addition to technical requirements, the arguments of TTRN will be provided to translators as a reference. Therefore, they should not be left blank.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you

@MattiaZir MattiaZir force-pushed the fix-TTR-resource-picker branch 2 times, most recently from e27f120 to 85dff52 Compare December 9, 2025 16:05
tooltip += "\n" + vformat(TTR("The %s cannot be edited in the inspector and can't be made unique directly."), resource_name) + "\n";
} else {
tooltip += unique_enable ? TTR(" Left-click to make it unique.") + "\n" : "\n";
tooltip += "\n" + TTR("Left-click to make it unique.") + "\n";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happened to unique_enable?
It should be something like

Suggested change
tooltip += "\n" + TTR("Left-click to make it unique.") + "\n";
if (unique_enable) {
tooltip += "\n" + TTR("Left-click to make it unique.") + "\n";
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch, I misread the logic there and removed the unique_enable by mistake.

@KoBeWi KoBeWi requested a review from timothyqiu December 9, 2025 17:12
@KoBeWi
Copy link
Member

KoBeWi commented Dec 9, 2025

Seems like get_custom_type_script() does not check if the object has relevant meta value.
image
You need to add has_meta(SceneStringName(_custom_type_script)) check.

@MattiaZir MattiaZir closed this Dec 10, 2025
@MattiaZir MattiaZir force-pushed the fix-TTR-resource-picker branch from edf17d6 to bb92a4c Compare December 10, 2025 00:37
@MattiaZir
Copy link
Contributor Author

Closing this to clean up the commit history, sorry.

Superseded by #113828

@AThousandShips AThousandShips removed this from the 4.6 milestone Dec 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Confusing message in linked resource indicator

5 participants