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

PO template automatic generation ignores call chaining #78416

Closed
Destructor17 opened this issue Jun 18, 2023 · 1 comment · Fixed by #86471
Closed

PO template automatic generation ignores call chaining #78416

Destructor17 opened this issue Jun 18, 2023 · 1 comment · Fixed by #86471

Comments

@Destructor17
Copy link

Destructor17 commented Jun 18, 2023

Godot version

v4.1.beta2.official [a2575cb]

System information

Godot v4.1.beta2 - Ubuntu 22.04.2 LTS 22.04 - Vulkan (Mobile) - integrated AMD Radeon Vega 8 Graphics (RADV RAVEN) () - AMD Ryzen 5 3500U with Radeon Vega Mobile Gfx (8 Threads)

Issue description

POT Generation ignores call chaining expressions. #77538 particularly covers this issue.

The workaround i used is to recurse thous expressions in GDScriptEditorTranslationParserPlugin::_assess_expression:

  • CallNode::callee in case of GDScriptParser::Node::CALL
  • SubscriptNode::base in case of GDScriptParser::Node::SUBSCRIPT. This case is currently not covered at all.

It would be also nice not to ignore anything in GDScriptEditorTranslationParserPlugin::_assess_expression to make POT Generation work in more general cases.

Steps to reproduce

Example code:

extends Node

class LabelManupulator:
	var _label: Label

	func _init(p_label: Label):
		_label = p_label

	func make_red() -> LabelManupulator:
		_label.modulate = Color(1, 0, 0, 1)
		return self

func _ready():
	add_label(tr("This message extracts correctly"))
	add_label(tr("This message is ignored")).make_red()

func add_label(p_text: String) -> LabelManupulator:
	var new_node = Label.new()
	new_node.text = p_text
	add_child(new_node)
	return LabelManupulator.new(new_node)

Reproduction steps:

  1. Save example code as .gd file in any project
  2. Open "Project settings", "Localization", sub-tab "POT Generation"
  3. Click "Add" and add that .gd file
  4. Click "Generate POT", choose a filename and save
  5. Check which strings were included in .pot file

Minimal reproduction project

N/A

@olivergs
Copy link
Contributor

olivergs commented Jan 30, 2024

The same happens if you use "await" in front of any call

somefunction(tr("This message extracts correctly"))
await somefunction(tr("This message is ignored"))

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.

4 participants