Skip to content

Conversation

Ivorforce
Copy link
Member

Should be merged together with godotengine/godot-docs#11188.

There seem to be quite a lot of links 'hardcoded' in the .po files as well; those will need to be updated too. Not sure if that can be done by script.

Copy link
Contributor

@Repiteo Repiteo left a comment

Choose a reason for hiding this comment

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

We should avoid hardcoding these values where possible. Some of the suggestions rectifying this rely on the following:

 core/string/ustring.cpp | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/core/string/ustring.cpp b/core/string/ustring.cpp
index 7541598e06..3557bad5cc 100644
--- a/core/string/ustring.cpp
+++ b/core/string/ustring.cpp
@@ -5973,10 +5973,10 @@ String DTR(const String &p_text, const String &p_context) {
 	const String text = p_text.dedent().strip_edges();
 
 	if (TranslationServer::get_singleton()) {
-		return String(TranslationServer::get_singleton()->doc_translate(text, p_context)).replace("$DOCS_URL", GODOT_VERSION_DOCS_URL);
+		return String(TranslationServer::get_singleton()->doc_translate(text, p_context)).replace("$DOCS_URL", GODOT_VERSION_DOCS_URL).replace("$CONTRIBUTE_URL", GODOT_VERSION_CONTRIBUTE_URL);
 	}
 
-	return text.replace("$DOCS_URL", GODOT_VERSION_DOCS_URL);
+	return text.replace("$DOCS_URL", GODOT_VERSION_DOCS_URL).replace("$CONTRIBUTE_URL", GODOT_VERSION_CONTRIBUTE_URL);
 }
 
 /**
@@ -5990,14 +5990,14 @@ String DTRN(const String &p_text, const String &p_text_plural, int p_n, const St
 	const String text_plural = p_text_plural.dedent().strip_edges();
 
 	if (TranslationServer::get_singleton()) {
-		return String(TranslationServer::get_singleton()->doc_translate_plural(text, text_plural, p_n, p_context)).replace("$DOCS_URL", GODOT_VERSION_DOCS_URL);
+		return String(TranslationServer::get_singleton()->doc_translate_plural(text, text_plural, p_n, p_context)).replace("$DOCS_URL", GODOT_VERSION_DOCS_URL).replace("$CONTRIBUTE_URL", GODOT_VERSION_CONTRIBUTE_URL);
 	}
 
 	// Return message based on English plural rule if translation is not possible.
 	if (p_n == 1) {
-		return text.replace("$DOCS_URL", GODOT_VERSION_DOCS_URL);
+		return text.replace("$DOCS_URL", GODOT_VERSION_DOCS_URL).replace("$CONTRIBUTE_URL", GODOT_VERSION_CONTRIBUTE_URL);
 	}
-	return text_plural.replace("$DOCS_URL", GODOT_VERSION_DOCS_URL);
+	return text_plural.replace("$DOCS_URL", GODOT_VERSION_DOCS_URL).replace("$CONTRIBUTE_URL", GODOT_VERSION_CONTRIBUTE_URL);
 }
 #endif
 

"There is currently no description for this method. Please help us by :ref:`contributing one <doc_updating_the_class_reference>`!",
"There is currently no description for this operator. Please help us by :ref:`contributing one <doc_updating_the_class_reference>`!",
"There is currently no description for this theme property. Please help us by :ref:`contributing one <doc_updating_the_class_reference>`!",
"There is currently no description for this class. Please help us by `contributing one <https://contributing.godotengine.org/en/latest/documentation/class_reference/index.html>`__!",
Copy link
Contributor

Choose a reason for hiding this comment

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

I really, really don't want us to have to use a hardcoded workaround like this. Will need @mhilbrunner to clarify if the original ref can somehow be retained (maybe it's already retained?)

Copy link
Member Author

Choose a reason for hiding this comment

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

I did attempt to redirect the doc_updating_the_class_reference ref name to an external link, but didn't succeed. I'm not sure if it's possible.

@Ivorforce Ivorforce force-pushed the contributing-links branch 2 times, most recently from a78752b to 5412a8f Compare September 9, 2025 21:37
Copy link
Contributor

@Repiteo Repiteo left a comment

Choose a reason for hiding this comment

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

I'm still not crazy about the hardcoding, but for a 4.5-stable timeframe this is acceptable

@Repiteo Repiteo modified the milestones: 4.x, 4.5 Sep 10, 2025
@Repiteo Repiteo added cherrypick:3.x Considered for cherry-picking into a future 3.x release cherrypick:4.2 Considered for cherry-picking into a future 4.2.x release cherrypick:4.3 Considered for cherry-picking into a future 4.3.x release cherrypick:3.6 Considered for cherry-picking into a future 3.6.x release cherrypick:4.4 Considered for cherry-picking into a future 4.4.x release labels Sep 10, 2025
@Repiteo Repiteo marked this pull request as ready for review September 11, 2025 15:36
@Repiteo Repiteo requested review from a team as code owners September 11, 2025 15:36
@Repiteo Repiteo merged commit 43395e2 into godotengine:master Sep 11, 2025
20 checks passed
@Repiteo
Copy link
Contributor

Repiteo commented Sep 11, 2025

Thanks!

@Ivorforce Ivorforce deleted the contributing-links branch September 11, 2025 16:43
@Repiteo
Copy link
Contributor

Repiteo commented Sep 11, 2025

Cherry-picked for 4.4

@Repiteo Repiteo removed the cherrypick:4.4 Considered for cherry-picking into a future 4.4.x release label Sep 11, 2025
@Repiteo
Copy link
Contributor

Repiteo commented Sep 11, 2025

Cherry-picked for 4.3

@Repiteo Repiteo removed the cherrypick:4.3 Considered for cherry-picking into a future 4.3.x release label Sep 11, 2025
@Repiteo
Copy link
Contributor

Repiteo commented Sep 11, 2025

Cherry-picked for 4.2

@Repiteo Repiteo removed the cherrypick:4.2 Considered for cherry-picking into a future 4.2.x release label Sep 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cherrypick:3.x Considered for cherry-picking into a future 3.x release cherrypick:3.6 Considered for cherry-picking into a future 3.6.x release documentation enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants