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

Doesn't work with godot localisation system #11

Open
anisc opened this issue Feb 11, 2021 · 9 comments
Open

Doesn't work with godot localisation system #11

anisc opened this issue Feb 11, 2021 · 9 comments

Comments

@anisc
Copy link

anisc commented Feb 11, 2021

Is there any way to use this plugin to work with the translation server ?

@3akev
Copy link
Owner

3akev commented Feb 12, 2021

As I said before, I haven't used it yet, but upon inspecting the docs, it seems like it should work like a normal label. Have you tried? What didn't work here, but did with a normal Godot label?

@anisc
Copy link
Author

anisc commented Feb 12, 2021

It work as a normal label
Because the whole reshaping happen at the .arabic_input level and because the translation key will be entered there too(arabic_input) the translation will happen at the .text level so will not be reshaped and will behave the same as Label.
So what I'm doing is, On _ready I force the translation in the .arabic_input
$Label.arabic_input = translationserver.translation(""string")

@anisc anisc closed this as completed Feb 12, 2021
@3akev
Copy link
Owner

3akev commented Feb 12, 2021

This is a workaround, not a fix. At least not yet. Can you share/link a minimal project which uses the translation server? I couldn't find any, nor figure out how to use it.

@3akev 3akev reopened this Feb 12, 2021
@anisc
Copy link
Author

anisc commented Feb 12, 2021

https://github.com/anisc/godotArabicPluginTest
The way the translation server works:
you create a file.csv with a special format ( I use google sheet ):

Key language1 language2
key1 word1 in language1 word1 in language1
key2 word2 in language1 word2 in language1

on godot
Project>Project Settings >Localization

Webp net-resizeimage

click on add and navigate to where ever you did place your file.csv, you will find file.language1.translation and file.language2.translation just load those.
and you just have to enter the key on the text of the label, Godot will do the rest.

On the example I made you can change the language by clicking on the button ( change language) .

@3akev
Copy link
Owner

3akev commented Feb 16, 2021

I see where the problem is, now.
Godot automagically overwrites the text property of text-bearing objects while translating; this is constantly being overwritten by the properly rendered output of arabic-input.

Ideally, it'd be best to have it just work with Godot, rather than monkey patch a solution.

Thus, it'll be one of two:

  1. Redesign the label code so text is both the input and the output, and that it is processed by BIDI code only once for every change in text.
  2. Or, failing that, monkey patch.

@anisc
Copy link
Author

anisc commented Feb 17, 2021

You are the expert :) thank you for sharing the plugin tho really appreciated !
and it seems that Godot are working on something to support arabic with godot 4 requiring to rethink their approach:
https://godotengine.org/article/complex-text-layouts-progress-report-1
https://godotengine.org/article/complex-text-layouts-progress-report-2
https://godotengine.org/article/complex-text-layouts-progress-report-3

@3akev
Copy link
Owner

3akev commented Feb 17, 2021

Yep, I'm aware. I plan to deprecate this when godot 4 comes out.

Progress report: I tried, brain broke. Might monkey patch instead.

@3akev
Copy link
Owner

3akev commented Feb 17, 2021

The problem is that with the way godot translation works, it's transparent to the attached script: text, in this case, the translation key, never changes, only what is displayed does. This script works by replacing disconnected glyphs with connected ones, writing to text. You can see how they're at odds.

@anisc
Copy link
Author

anisc commented Feb 17, 2021

I tried something like this:

func set_text(s):
	var translated = TranslationServer.translate(s)
	if translated!=s:
		if TranslationServer.get_locale() == "ar":
			var temptext = wrap_text(s) if autowrap else s
			translated = arabic.process_text(temptext)
	.set_text(translated)
	#_set_arabic_input(s) 

but didn't work.
I think for now the workaround would be good enough, as this plugin will be deprecated any way.

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

No branches or pull requests

2 participants