Hello,
For example, I am translating :
https://hosted.weblate.org/translate/godot-engine/godot-docs/fr/
But actually,
The generated github link for https://hosted.weblate.org/translate/godot-engine/godot-docs/fr/?checksum=5f1802262bfd10b1 to original source is wrong:
https://github.com/godotengine/godot-docs-l10n/docs/getting_started/scripting/gdscript/gdscript_advanced.rst#L390 location is not offered by github.
https://github.com/godotengine/godot-docs-l10n/docs/ doesn't exist as docs is a github submodule of https://github.com/godotengine/godot-docs-l10n/ (a link to another repository) see : https://github.com/godotengine/godot-docs-l10n/blob/master/.gitmodules
Regards
Please configure it properly here: https://hosted.weblate.org/settings/godot-engine/godot-docs/#vcs
Probably @akien-mga could take a look...
Thanks for the ping @nijel.
I'm not sure it can be solved properly with the way we set up our https://github.com/godotengine/godot-docs-l10n repository.
The source files are in the docs submodule, which as mentioned above, cannot be used to link to a file directly with e.g. https://github.com/godotengine/godot-docs-l10n/docs/getting_started/scripting/gdscript/gdscript_advanced.rst#L390
Weblate lets us configure the URL to resolve to (default is https://github.com/godotengine/godot-docs-l10n/blob/%(branch)s/%(file)s#L%(line)s), so in theory it could be changed to point to https://github.com/godotengine/godot-docs, but the problem is that %(file) in our case is a relative path to the docs submodule, e.g. (for the above URL) docs/​getting_started/​scripting/​gdscript/​gdscript_advanced.rst, while for the godot-docs repo we'd need that path without the docs/ prefix.
I can think of two solutions:
%(file) is inferred from the location hint (../​../​docs/​getting_started/​scripting/​gdscript/​gdscript_advanced.rst:390). Currently it properly resolves the relative path to start at the repository's root, but in our case we'd need a way to filter out the docs/ folder. I'm not sure how to do this usability wise though, and not sure if it's worth the effort, unless other projects have similar issues.sed the docs/ part of the hint away, and then Weblate's %(file) should be usable for our godot-docs repo. The drawback is that people doing local translation with a checked out submodule would get a broken location path - but we don't really support that workflow anyway, so it's probably not too bad.
- On the Godot side, I could just
sedthedocs/part of the hint away, and then Weblate's%(file)should be usable for ourgodot-docsrepo. The drawback is that people doing local translation with a checked out submodule would get a broken location path - but we don't really support that workflow anyway, so it's probably not too bad.
One question for @nijel though: if I were to remove the whole ../../docs/ part of the path instead of just docs/, would that break the logic that determines %(file), or is it clever enough to find its way?
I haven't read all the comments, just quick note: You can also use relative paths like %(../../file)s, see https://docs.weblate.org/en/latest/admin/projects.html#component-configuration
In my case I would need to remove the docs/ part already contained in %(file)s, so unless it supports a syntax for substring deletions like Bash's %{file#docs/}, that won't work as is in this case. I'll go with the tweak to our location hint strings directly.
Though it wouldn't work in general, you may use https://github.com/godotengine/godot-%(file)s here... @akien-mga
That's exactly what %(../file)s does.
Thanks, that seems to be needed to get rid of the leading ../../ of my location hints, but it does not work to remove the docs/ prefix eventually.
Here's the output of several format strings, for this source hint: ../​../​docs/​getting_started/​scripting/​gdscript/​gdscript_advanced.rst:390:
https://github.com/godotengine/godot-docs/blob/%(branch)s/%(file)s#L%(line)s: https://github.com/godotengine/godot-docs/docs/getting_started/scripting/gdscript/gdscript_advanced.rst#L390https://github.com/godotengine/godot-docs/blob/%(branch)s/%(../file)s#L%(line)s: https://github.com/godotengine/godot-docs/blob/docs/getting_started/scripting/gdscript/gdscript_advanced.rst#L390https://github.com/godotengine/godot-docs/blob/%(branch)s/%(../../file)s#L%(line)s: https://github.com/godotengine/godot-docs/blob/master/docs/getting_started/scripting/gdscript/gdscript_advanced.rst#L390https://github.com/godotengine/godot-docs/blob/%(branch)s/%(../../../file)s#L%(line)s: Bad format string (u'../../../file')This shows that %(../../file)s is needed to remove the leading ../../ of my hint string (otherwise it removes the blob/%(branch)s/ part), but can't be used to actually remve the docs/ part after those ../../.
Yes, probably you can't go beyond grandpa!
Seeing advance of different translations, seding source path string (to minimal possible path string) in English file shouldn't affect anyone, imho.
Unless it is actually used by weblate to identify strings ? (in that case currently translated .po should be saved, so they can be uploaded again..., while seding them too)
I've just added that option to the code, will deploy it later today.
Seems fixed. 👍
Yes, the new option added in bf2d557 seems to work great, thanks!
Thank you for your report, the issue you have reported has been fixed (and properly labeled as enhancement).