12 Replies Latest reply on Jul 6, 2006 7:13 AM by wgb14

    Greek to Greeklish conversion

    wgb14 Level 1
      Hi all

      I wonder if there is a way to convert a greek string to greeklish (latin-based) with lingo. For example, given

      "καλημερα" to tranlate to "kalimera" (both are greek words for goodmorning)

      Is there any way to write a handler that would do that conversion to the text of a cast mamber that is updated dynamically with greek phrases?


      Any ideas will be appriciated

      Many thanks
        • 1. Re: Greek to Greeklish conversion
          Level 7
          > "????????" to tranlate to "kalimera" (both are greek words for goodmorning)

          Unfortunately your original greek word was mangled in transmission (or
          by my newsreader), but if there is a 1-to-1 character mapping you're
          wishing to perform you could use a lingo list, or the (free) PRegEx
          xtra's method PRegEx_Translate()
          If it's a word to word mapping you need, you could again use a lingo
          list, or perhaps a database depending on performance and size constraints.
          • 2. Re: Greek to Greeklish conversion
            Level 7
            you'll have to create a character map, and then replace each char.
            If you are concearned about the flash right before the replacement, it can
            be fixed by using code based on the keyDown and keyCode, instead of the
            following..

            Attach to a sprite of an editable text member.

            property pCharMap, pMem
            on beginSprite me
            pCharMap=["A":"a", "B":"b"] -- replace A with greek alpha, B with greek
            beta, and add the rest characters.
            pMem=sprite(me.spriteNum).member
            end

            on keyUp me
            myTextL=pMem.char.count
            repeat with i=1 to myTextL
            charPos=pCharMap.findPos( pMem.char )
            if charPos then put pCharMap[charPos] into pMem.char

            end repeat
            end


            "wgb14" <webforumsuser@macromedia.com> wrote in message
            news:e8emoj$ooi$1@forums.macromedia.com...
            > Hi all
            >
            > I wonder if there is a way to convert a greek string to greeklish
            > (latin-based) with lingo. For example, given
            >
            > "????????" to tranlate to "kalimera" (both are greek words for
            > goodmorning)
            >
            > Is there any way to write a handler that would do that conversion to the
            > text
            > of a cast mamber that is updated dynamically with greek phrases?
            >
            >
            > Any ideas will be appriciated
            >
            > Many thanks
            >


            • 3. Re: Greek to Greeklish conversion
              wgb14 Level 1
              Hi

              Thanks for your replies

              I haven;t tried the Xtra but i did try the code of alchemist which returns an error every time thta i am typing a greek letter in a text field with the code attached as a behaviour. The error that i am getting is:

              script error:property not found
              charPos=pCharMap.findPos( pMem.char )
              #char

              • 4. Re: Greek to Greeklish conversion
                Level 7
                What type of member does the sprite to which you attached the behavior
                reference? Is it #text, #field, #flashComponent or something else?
                • 5. Re: Greek to Greeklish conversion
                  wgb14 Level 1
                  Hi

                  I tried it on both text and field and i still get the same error

                  • 6. Re: Greek to Greeklish conversion
                    Level 7
                    http://gomu.rebus.gr/pub/charMapEditBox.zip

                    just check if the mappings, case you want to change anything.
                    caution: do not add spaces in the map strings.


                    "wgb14" <webforumsuser@macromedia.com> wrote in message
                    news:e8evtc$5ap$1@forums.macromedia.com...
                    > Hi
                    >
                    > I tried it on both text and field and i still get the same error
                    >
                    >




                    • 7. Re: Greek to Greeklish conversion
                      wgb14 Level 1
                      Alchemist the script is working perfectly. However, i wonder if there is any way to modify it in order to achieve a slightly different functionality. In particular i have the following script

                      on mousedown me

                      pointClicked = _mouse.mouseLoc
                      currentMember = sprite(1).member
                      lineNum = sprite(1).pointToLine(pointClicked)
                      lineText = currentMember.line[lineNum]

                      case lineNum of
                      1: put lineText into member "test"
                      2: put lineText into member "test"
                      3: put lineText into member "test"
                      end case

                      end

                      When the user clicks on the correpsonding number the text of member "test" is updated with a new greek string (a full phrase). Now i want to convert this text to Greeklish so i can further process it. Is there any way to do that?

                      Many thanks for your help
                      • 8. Re: Greek to Greeklish conversion
                        Level 7
                        I don't get what you want to do.
                        If you want to convert a custom string, just make the code to use strings
                        instead of the active member.
                        Then you can call it from any handler.
                        I used the member approach case for this app it should be faster + any rtf
                        formatting would be retained.

                        Btw, check the charPosToLoc command and the selection property

                        put member(1).charPosToLoc(1)
                        -- returns the position of a character in a text member, relative to the u-l
                        corner of the member

                        put member(1).selection
                        -- returns the selected characters [first, last]. If fist=last, the cursor
                        position


                        "wgb14" <webforumsuser@macromedia.com> wrote in message
                        news:e8f36r$8nc$1@forums.macromedia.com...
                        > Alchemist the script is working perfectly. However, i wonder if there is
                        > any
                        > way to modify it in order to achieve a slightly different functionality.
                        > In
                        > particular i have the following script
                        >
                        > on mousedown me
                        >
                        > pointClicked = _mouse.mouseLoc
                        > currentMember = sprite(1).member
                        > lineNum = sprite(1).pointToLine(pointClicked)
                        > lineText = currentMember.line[lineNum]
                        >
                        > case lineNum of
                        > 1: put lineText into member "test"
                        > 2: put lineText into member "test"
                        > 3: put lineText into member "test"
                        > end case
                        >
                        > end
                        >
                        > When the user clicks on the correpsonding number the text of member "test"
                        > is
                        > updated with a new greek string (a full phrase). Now i want to convert
                        > this
                        > text to Greeklish so i can further process it. Is there any way to do
                        > that?
                        >
                        > Many thanks for your help
                        >
                        >


                        • 9. Re: Greek to Greeklish conversion
                          Level 7
                          wgb14 wrote:
                          > I haven;t tried the Xtra but i did try the code of alchemist which
                          > returns an error every time thta i am typing a greek letter in a text
                          > field with the code attached as a behaviour. The error that i am
                          > getting is:
                          >
                          > script error:property not found
                          > charPos=pCharMap.findPos( pMem.char )
                          > #char

                          That line should be
                          charPos=pCharMap.findPos( pMem.char[ i ] )

                          Andrew


                          • 10. Re: Greek to Greeklish conversion
                            wgb14 Level 1
                            Alchemist

                            What i am trying to do is to use your code to convert a pre-existing string in Greeklish (without having to type anything). For example:

                            Lets say that i have the greek word "Goodmorning" in to a text member on a stage. I want to convert that word to greeklish by simply pressing a button (e.g., convert). I am trying to modify your code but I am not sure how to make to convert whole strings at once, instead of letter-by letter conversion.

                            Any ideas will be appriciated
                            • 11. Re: Greek to Greeklish conversion
                              Level 7
                              http://gomu.rebus.gr/pub/charMapEditBoxGlobal.zip

                              The only thing you need is the grConvert movie script. Just copy it to your
                              cast, and then call : myGreeklishText = grConvert("myGreekText") from
                              anywhere.


                              "wgb14" <webforumsuser@macromedia.com> wrote in message
                              news:e8hpil$m8f$1@forums.macromedia.com...
                              > Alchemist
                              >
                              > What i am trying to do is to use your code to convert a pre-existing
                              > string in
                              > Greeklish (without having to type anything). For example:
                              >
                              > Lets say that i have the greek word "Goodmorning" in to a text member on a
                              > stage. I want to convert that word to greeklish by simply pressing a
                              > button
                              > (e.g., convert). I am trying to modify your code but I am not sure how to
                              > make
                              > to convert whole strings at once, instead of letter-by letter conversion.
                              >
                              > Any ideas will be appriciated
                              >



                              • 12. Re: Greek to Greeklish conversion
                                wgb14 Level 1
                                Alchemist is workign perfectly!!!! Many many thanks... you are really fantastic thanks