Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Readable Content and Title fields aren't detected during POT generation for localization #358

Open
MithosKuu opened this issue Jan 17, 2025 · 3 comments

Comments

@MithosKuu
Copy link

Discussed in #357

Originally posted by MithosKuu January 16, 2025
I'm messing around with localization and am hitting an issue with the Readable Component. The Interaction Text field is getting detected as a valid string to be localized during POT generation, but the Readable Content and Title fields are not.
image
image
image
image
Strangely Godot does see them as valid and translates them if I set them to an existing string
image
image

@Phazorknight
Copy link
Owner

Hm... that is odd. I haven't really looked into localization with Godot so my help will be very limited.

On the back end, all of these exported variables are strings, the interaction text as well as the readable title and content. So they should all work the same.

My first guess would be that it's more about the component scene / object scene instances, but then you'd probably have the same issue with the interaction text, so that's what baffles me a bit.

@MithosKuu
Copy link
Author

MithosKuu commented Jan 18, 2025

Looks like it can only grab anything from the Intractables if the Intractable is the root node

Image

If I add the Lobby scene to the POT generation list it doesn't grab any of the interactables at all

Image

@Phazorknight
Copy link
Owner

Okay I took a quick look at how POT generation works. As it goes by resource, you'd have to add each individual scene to it. Packed Scenes within scenes don't seem to get properly detected by the POT generator.

Another issue that comes up with this is that if you reuse Components that are packed scenes and you add those scenes to the POT resources, that translation will be applied to all of them. This is probably fine for stuff like the interaction prompts like "Read this", but you don't want all your readable objects have the same content.

In order for this to work you will have to make the readable component "local" to your object.

As an example I've taken the Note_Welcome object from the Lobby demo scene. It contains a PackedScene of a ReadableComponent.
So for me to make the contents of that component show up in the POT generation and have these only apply to the Note_Welcome, I'll have to turn the ReadableComponent local.

Image

Note how the names of the child nodes of the ReadableComponent are white as they are now all part of the Note_Welcome scene.

Then I add the Note_Welcome scene to the POT Generator resources:

Image

In the end, all these strings now show up in the POT file:

Image

So in summary: It's doable but needs some planning in how you structure your objects and their components.
I'd also wait until the very end of your project before generating the POT file as making your PackedScenes local will make you lose them being instances to the same PackedScene (and thus applying changes to all)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants