Localize Image position accroding to language
8 years 3 months ago - 8 years 3 months ago #1734
by zaher
Localize Image position accroding to language was created by zaher
Hello.
I am facing a problem in localization and while reading about solutions I found this asset.
My question is:
I build UIs and within some of them there is texts within them images. However when changing to other languages the place of the images must be moved according
to the place of the companion suitable word. For example:
In English localized UI:
You need 1 key [keyImage]
In Turkish localized UI should be:
1 anahtara [keyImage] ihtiyacin var
Does this asset solve this problem. So the image positions are also localizable with it too?
Thanks.
I am facing a problem in localization and while reading about solutions I found this asset.
My question is:
I build UIs and within some of them there is texts within them images. However when changing to other languages the place of the images must be moved according
to the place of the companion suitable word. For example:
In English localized UI:
You need 1 key [keyImage]
In Turkish localized UI should be:
1 anahtara [keyImage] ihtiyacin var
Does this asset solve this problem. So the image positions are also localizable with it too?
Thanks.
Last edit: 8 years 3 months ago by zaher.
Please Log in or Create an account to join the conversation.
8 years 3 months ago #1735
by Frank
Are you Give I2L 5 stars!
Are you Please lets us know how to improve it!
Replied by Frank on topic Localize Image position accroding to language
I will do it If you are using setting the image using tags in your text
(something like: forum.unity3d.com/threads/sprite-icons-w...265927/#post-1897531
or )
In that case, you could make your translations use the tags in the correct section, the plugin will change the text of the label based on the language, and the renderer you are using will convert the tags into images.
Term: "My Term"
English: "You need 1 key <sprite=keyImage>"
Turkish: "1 anahtara <sprite=keyImage> ihtiyacin var"
(this process will happen automatically)
If you are not, and instead you are placing the image by code yourself, then you will have to encode the image in the text and then at runtime, get the translation and parse the text and move the image.
Term: "My Term"
English: "You need 1 key <sprite=keyImage,10,20>"
Turkish: "1 anahtara ihtiyacin var <sprite=keyImage,2,20>"
in code:
Both ways will place the images in the right position based on the language. The first way is built-in and happens without adding any custom code, the second one is a bit more involved but will work if you are not using tags for your images.
(something like: forum.unity3d.com/threads/sprite-icons-w...265927/#post-1897531
or )
In that case, you could make your translations use the tags in the correct section, the plugin will change the text of the label based on the language, and the renderer you are using will convert the tags into images.
Term: "My Term"
English: "You need 1 key <sprite=keyImage>"
Turkish: "1 anahtara <sprite=keyImage> ihtiyacin var"
(this process will happen automatically)
If you are not, and instead you are placing the image by code yourself, then you will have to encode the image in the text and then at runtime, get the translation and parse the text and move the image.
Term: "My Term"
English: "You need 1 key <sprite=keyImage,10,20>"
Turkish: "1 anahtara ihtiyacin var <sprite=keyImage,2,20>"
in code:
var translation = I2.Loc.ScriptLocalization.Get("My Term");
var spriteData = translation.SubString( translation.IndexOf("<sprite"));
translation = translation.SubString( 0, translation.IndexOf("<sprite"));
label.Text = translation;
var spriteName = ..... use Regex to get spritename from spriteData string ....
var spriteX = .....
var spriteY = .....
var sprite =label.FindChild(spriteName);
sprite.position = new Vector3(spriteX, spriteY, 0);
Both ways will place the images in the right position based on the language. The first way is built-in and happens without adding any custom code, the second one is a bit more involved but will work if you are not using tags for your images.
Are you Give I2L 5 stars!
Are you Please lets us know how to improve it!
To get the betas as soon as they are ready,
check this out
The following user(s) said Thank You: zaher
Please Log in or Create an account to join the conversation.
8 years 3 months ago #1737
by zaher
Replied by zaher on topic Localize Image position accroding to language
Thank you very much for your detailed answer. I appreciate it.
I am currently thinking of the best solution to choose
The only remaining issue for the second solution is after detecting the image tag place I have to know how much each character is taking space depending on the localized languages too.
Thanks again
I am currently thinking of the best solution to choose
The only remaining issue for the second solution is after detecting the image tag place I have to know how much each character is taking space depending on the localized languages too.
Thanks again
Please Log in or Create an account to join the conversation.
Time to create page: 0.145 seconds