Forum rules - please read before posting.

Arabic Support

edited September 2014 in Engine development
Hi and thank you, as always.

The new functionalities of the last version work and help me a great way, meanwhile I'm also much more familiar with the AC code.
I need just a few more hints to fully implement Arabic support.

1) Right to left writing backspace
When I sue the backspace on right to left it cancel the first letter, not the last one, as it should.

2) Arabic input
I'm trying to insert arabic letters in the input, but they seems to be unauthorized.
I'm exploring the MenuInput.cs, but I'm not sure what to touch.

3) Apply arabic translation while importing translation
I need to import the arabic translation into the game, but I need to apply few changes.
For example I need to add some scripts before adding the text to the menus.

Ex.
If translation is french
-> simply import translated text
-> apply translated text to everything (subtitles, menus etc)

If translation is arabic
-> import translation
-> apply script to imported text
-> apply translated/updated text to everything (subtitles, menus etc)

Where I could add it the script?

4) Subtitles from right to left
I can use subtitles from right to left, but they show the last letter, not the first one.
(They start showing the text from right to left, but they keep showing the first word on the left as first and then add others on the right)

They should be showing:
987654321
Starting from 9 and then reaching 1
Instead they show
123456789
Starting from 1 and then reaching 9.

Which code I need to adjust to apply this change?

Thank you very much.

Comments

  • 1) Fixed for 1.39.

    2) Is not using a custom font not enough?  I'd imagine this'd be the solution with other alphabets, such as Chinese, too.

    3) Make the changes before importing the translation text.  You can do this outside of Unity, even - the text files are supposed to be edited in e.g. Excel.

    4) You're confusing the text-alignment with being able to reverse the text.  Currently, there is no way to reverse labels in the same way as Inputs, but I'll add this if it's necessary for Arabic support.
  • edited September 2014
    3) Make the changes before importing the translation text.  You can do this outside of Unity, even - the text files are supposed to be edited in e.g. Excel.

    It's not just an issue of order. I need to place the letters in a particular way that unity doesn't recognize for itself.

    If I simply place the text (that in the csv file can be viewed correctly) I see the following:
    image

    If I revert manually  it on excel I get this. Now the order is correct, but arabic needs also spacing and some specific letters has particular behaviours:
    image

    So to solve the issue I need to apply this asset to the text. Using this asset I can show the right text (I tried it manually and it worked, but I'd like to apply it to each text automatically).
    image

    The line of code to be added is very simple.
    I need to add the following library:
    using ArabicSupport;

    And then I just apply this code:
    ArabicFixer.Fix(textToBeFixed);

    I just need to know where to apply that line and everything should be happily solved (I hope).
  • Look inside MenuLabel.cs (or whichever element you wish to change).  The text is displayed within the Display function at the bottom - in MenuLabel this is stored in the string newLabel.
  • edited September 2014
    Ok! Thank you for the answer!


    After seeing the code I found where translation happens.
    I tried to apply the code in the method
    TranslateLabel

    of the MenuElement.cs

    I just changed the line from:
    return (SpeechManager.GetTranslation (lineID, Options.GetLanguage ()));

    To
    return (ArabicFixer.Fix(SpeechManager.GetTranslation (lineID, Options.GetLanguage ())));

    And it seems to be working. Let me know if this could raise any issues.
  • Should be all right.  Glad it's sorted out.
  • edited January 2015
    After the new UI this issue raised again. The arabic text is displaying in the wrong way.

    Short version:
    I need to apply a special method to adjust the text before displaying it, not sure where.
    So: Where should I place the "ArabicFixer(text)" command to make it working?

    Sub request:
    While finding the solution where can I find the last version before of the GUI update?

    --------------------------------

    More details:
    I'm not sure why, but the text on the labels displays correctly and the buttons don't.
    Other thing, if, during gameplay I set the language to arabic and I try accessing a MenuButton.Label, it returns the original languange and not the translation (while before was returning the translated language).

    So:
    1) Start Game
    -> MenuButton.Label = Orignal Text
    2) Change Translation
    -> Current Version: MenuButton.Label = Orignal Text 
    -> Pre UI Version: MenuButton.Label = Translated Text

    Thank you very much.
  • edited January 2015
    Solution found, for most of the MenuElements.
    I'm currently adding the fixer in the pre display and it works for every menu element, except conversations and inputs.

    The PreDisplay method of the MenuDialogList and MenuInput are called multiple times, so it continue to apply the fixer. Is it possible to solve this?

    --------------------------Working solutions
     * MenuLabel.cs 
     * added line 259
     * if (Options.GetLanguage() == 1) newLabel = ArabicFixer.Fix(newLabel);
     * 
     * MenuButton.cs
     * added line 267
     * if (Options.GetLanguage() == 1) fullText = ArabicFixer.Fix(fullText);
     * 
     * MenuCycle.cs
     * add line 221
     * if (Options.GetLanguage() == 1) cycleText = ArabicFixer.Fix(cycleText);
     * 
     * MenuToggle.cs
     * added line 174
     * if (Options.GetLanguage() == 1) fullText = ArabicFixer.Fix(fullText);
     

    ---------------Errors to be fixed
    The following adjustments doesn't work. The are called continuously (maybe in an Update).
    Please let me know if I need to place them somewhere else.
      * MenuDialogList.cs
     * added line 189
     * if (Options.GetLanguage() == 1) labels[_slot] = ArabicFixer.Fix(labels[_slot]);
     * 
     * MenuInput.cs
     * Added line 158
     * if (Options.GetLanguage() == 1) label = ArabicFixer.Fix(label);
  • You'd likely be able to get around this by using two labels instead - one for "ACs" Text component, the other for the Arabic fixer, which would be the only one actually visible.
  • edited January 2015
    Could you please add more details?

    "You'd likely be able to get around this by using two labels instead - one for "ACs" Text component, the other for the Arabic fixer, which would be the only one actually visible."

    Do you mean I should hide one label and create on other?

    Do you have any hints about which method I should modify / adjust?
  • Ok. I found a temporary solution.

    For MenuInput was not a great deal.
    I just do the fixing each time player insert a new input.

    For the MenuDialogList I had to make some more adjustments.
    I've created a global variable to make sure to do the change just one time.

    If possible, for future version, I'd ask to implement just one call for the PreDisplay of MenuDialogList.
    As much as I see it PreDisplay should be called one time as default (as for all the other MenuElements).

    Anyway thank you very much, as always!


    For the ones interested on the solution the code is the following:
    if (Options.GetLanguage() == 1) labels[_slot] = ArabicFixer.Fix(labels[_slot]);
                 if ((Options.GetLanguage() == 1) && AC.GlobalVariables.GetBooleanValue(103))                    {
                        countOptions = 0;
    AC.GlobalVariables.SetBooleanValue(103, false);
                        Debug.Log(countOptions);
    }
                    if (countOptions < labels.Length)
                    {
                        labels[_slot] = ArabicFixer.Fix(labels[countOptions]);
                        Debug.Log("DoneOneTimePer Row" + countOptions);
                        countOptions++;
                    }
  • WordWrap for labels.

    Now the word wrap has the following behaviour:

    If I've the string '1234567890' and I wrap it I will have the following:
    12345
    67890

    I need the opposite behaviour, I need to wrap it in the following way:
    67890
    12345

    Is it possible?
  • So it wraps "upwards"?  You'd probably need to have a script that creates a wrap-like effect (e.g. inserts a new line after a certain number of characters).  I'd suggest asking on Unity's own forum - this is a UI-related question, not so much an AC one.
  • Hi there.
    Give a little tutorial methods What is?

    Please

    Thank you
  • There's not much to it beside providing a new translation and naming it "Arabic".

    This tutorial goes through the steps of creating a new translation.
  • I am very sorry to bring this thread up.
    I am stuck with an Arabian issue (=P)

    AC has been update, and thus some of what is mentioned here is hard to locate.
    So far I managed to fix the Pause Menu, I would like to fix the Arabian writing for the subtitle and other menu elements, it took me a while to figure some places to add my Arabic.Prase() line of code =)

    Thanks in advance! =)
  •   I just noticed in the Speech in the editor I can click on Right to Left!
    Will try that!
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.