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

Localization remaps don't work for themes in exported project #97263

Open
conest opened this issue Sep 21, 2024 · 8 comments · May be fixed by #103838
Open

Localization remaps don't work for themes in exported project #97263

conest opened this issue Sep 21, 2024 · 8 comments · May be fixed by #103838

Comments

@conest
Copy link

conest commented Sep 21, 2024

Tested versions

4.3 stable

System information

Godot v4.3.stable - macOS 14.5.0 - Vulkan (Forward+) - integrated Apple M2 Pro - Apple M2 Pro (10 Threads)

Issue description

I attempted to use localization remaps to switch between different themes(.tres files) to suit various languages and apply different font styles. Everything worked fine during testing in the editor, but after exporting, the remap didn’t function as expected — the label’s font and size didn’t change.
Maybe related to this one: Changing the locale breaks remapped fonts

Steps to reproduce

  1. Run the root.tscn.
  2. Press 2 buttons to change the locale and check the font on the label.
  3. Export project.
  4. Run the exported project and follow the step 2 again.

Minimal reproduction project (MRP)

Archive.zip

@ghost
Copy link

ghost commented Sep 21, 2024

Exported game output this into terminal:

WARNING: Translation remap 'res://font_en.tres' does not exist. Falling back to 'res://font_en.tres'.
     at: _path_remap (core/io/resource_loader.cpp:1197)
WARNING: Translation remap 'res://font_ja.tres' does not exist. Falling back to 'res://font_en.tres'.
     at: _path_remap (core/io/resource_loader.cpp:1197)

Seems that this 2 resources doesn't get included in exported build?

@conest
Copy link
Author

conest commented Sep 21, 2024

Exported game output this into terminal:

WARNING: Translation remap 'res://font_en.tres' does not exist. Falling back to 'res://font_en.tres'.
     at: _path_remap (core/io/resource_loader.cpp:1197)
WARNING: Translation remap 'res://font_ja.tres' does not exist. Falling back to 'res://font_en.tres'.
     at: _path_remap (core/io/resource_loader.cpp:1197)

Seems that this 2 resources doesn't get included in exported build?

Yes, I tried exporting them explicitly, but it still didn’t work.
Screenshot 2024-09-21 at 14 28 46

@ghost
Copy link

ghost commented Sep 21, 2024

Adding new labels and applying that themes to them - works, so resources definitely included in exported build.
зображення

@conest
Copy link
Author

conest commented Sep 22, 2024

Adding new labels and applying that themes to them - works, so resources definitely included in exported build. зображення

My tests reached the same conclusion. It seems that the remaps resources are not shared with the regular resources, or not properly linked for some reason.

@geekley
Copy link

geekley commented Jan 14, 2025

I'm having this same issue and error message, but on a custom resource, unrelated to themes, and only in Web exports.
I tried even using metadata to reference a resource that points to all locale variations, but no luck.
I guess I'll have to avoid the localization remap system entirely and use my own code for this... 😞

@ebeem
Copy link

ebeem commented Mar 8, 2025

I am facing the same issue, I think it's related to #84791
After checking my .pck file, I noticed that the extensions of remaps is .remap

For example, my file main-menu-theme.tres will become main-menu-theme.tres.remap rather than main-menu-theme.tres.import
So how to fix this? I think we need to skip also the extension .remap

I will see if I can test this, my project uses mono, it's much harder to compile, but I will try

	if (!FileAccess::exists(new_path + ".import") && !FileAccess::exists(new_path + ".remap") && !FileAccess::exists(new_path)) {
			WARN_PRINT(vformat("Translation remap '%s' does not exist. Falling back to '%s'.", new_path, p_path));
			new_path = p_path;
		}

@ebeem
Copy link

ebeem commented Mar 8, 2025

I can confirm that the inclusion of ".remap" in file exists solves the problem
Will create a PR for this

@ebeem ebeem linked a pull request Mar 8, 2025 that will close this issue
@ebeem
Copy link

ebeem commented Mar 8, 2025

Created the PR #103838
You can test it if you would like to, but a export template will have to be built for each target. Which is a lot of effort.

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

Successfully merging a pull request may close this issue.

5 participants