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

.cs is not an option in POT generation files #84203

Open
wdhtcsjh opened this issue Oct 30, 2023 · 5 comments
Open

.cs is not an option in POT generation files #84203

wdhtcsjh opened this issue Oct 30, 2023 · 5 comments

Comments

@wdhtcsjh
Copy link

Godot version

4.1.2-stable

System information

Godot v4.1.2.stable.mono - Arch Linux #1 SMP PREEMPT_DYNAMIC Thu, 26 Oct 2023 00:52:20 +0000 - Tty - Vulkan (Forward+) - dedicated NVIDIA GeForce GTX 1050 Ti (nvidia; 535.113.01) - Intel(R) Core(TM) i5-8300H CPU @ 2.30GHz (8 Threads)

Issue description

Currently cannot add cs files to pot generation.

Steps to reproduce

Go to Project Settings, Select Localization in the Settings Screen. Click on POT Generation in the subscreen. Click on Add.
Go to the bottom right drop down and click to show the options and .cs does not exist.

Minimal reproduction project

Can do this with a new project.

@AnidemDex
Copy link

AnidemDex commented Oct 30, 2023

.cs is used for CSharp scripts, isn't it?

According docs, Godot uses .po or .mo

Edit: My commentary was not relevant for this issue, thank you for the clarification 😅

@akien-mga
Copy link
Member

@AnidemDex The POT generation feature is something that parses the project scenes and scripts to extract strings and generate a POT file. The POT file is then use to generate PO files for translation.

Here the problem is AFAIR simply that there is no builtin translation string extraction plugin for C# scripts, so the feature is not supported yet for such scripts.

@AdriaandeJongh
Copy link
Contributor

The ability to scan C# .cs files for POT generation is really a core missing feature when it comes to Godot's otherwise well integrated translation system. Perhaps the lack of this feature should be mentioned clearly in the documentation. And while I'm talking about the documentation, all code examples about translation are GDScript only, which maybe makes sense considering no POT Generation support for C#?

@Calinou
Copy link
Member

Calinou commented Dec 15, 2023

@HKunogi
Copy link
Contributor

HKunogi commented Oct 8, 2024

One idea that may be worth is the way POEdit does for code files, it allows you to define what function is called for translations, so lets say you have a 'Localization.GetString(string key)', then it would search on source files for places calling this specific function and take the actual key argument you passing on the call to this function, adding it as key on the POT. Godot does have few functions like Tr() and TranslationServer.Translate() which could be used as search points on C# code and wherever its found, then get the arguments passed to add on the POT file (and maybe additionally allow the user to define custom functions to search for as well). It can be done either by simply scanning the .cs file as text or for more advanced tracking, would need to build it (without AOT) and use reflection on the built library to scrap for references (would be way more precise and could even track variables being passed, but its way more complex to be done).

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

No branches or pull requests

6 participants