We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 4673
    • 577 Posts
    start of WARNING
    You have to overwrite several files. If you do and things get screwed up, blame yourself for not making copies, don’t come whinning to me!
    end of WARNING

    smiley now that is out of the way ...

    Ok folks, here is what I’ve been playing with. Technically this should be alpha but after playing with this for a bit let’s bump it to Beta 1.0 grin

    This is actually a hack that requires jazzing up a bit of the core code in several files.

    - You will also need to add 1 field to the site_content table.
    - The rest is just upload over previous files.

    I’ve also included some examples for TVs and Chunks to get you going.

    shocked This is only intended to be an interm solution until the new API for 1.0 comes out. However, in the meantime this might be something useful.

    Cheers!

    EDIT:
    here is my field for site_content, I just copied it from the dump for my db. But it should help you add the field.
    `lang` char(2) NOT NULL default ’en’,

    Clarification:
    This allows you to do basically the same thing as Susan’s cookie code. Except now it is in the manager and you can change the language declaration as you would if it were published or not .... NOTE .... No quick right-click ability but rather you need to go to the "page settings" section when editing the document.

    TO DO:
    Figure out how to call ’lang’ from the parser to cut down on the sql call that is needed in a TV.
    Does anybody know how to do this?
      Tangent-Warrior smiley
      • 25663 MODX Staff
      • 12,272 Posts
      OK... so what exactly does this language hack do?
        Ryan Thrash, MODX Co-Founder
        Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
        • 4673
        • 577 Posts
        Did you open it? tongue
        Easy enough:

        Joking aside:

        If you install only the mutate page for the admin you can see that I put in a drop down menu that allows you to choose a language for the document. This way you can use a TV or something to allow you to do fun stuff without resorting to Susan’s cookie method. You just have to run a simple sql call and then show what ever menu or what not.

        ughhh I’m not doing well with words today.

        anyway, if you’ve tried Susan’s cookie hack then you should get the idea. However, with this hack you don’t have to worry about cookies and all that. You just select your language and off you go.

        EDIT:
        This does work except that I can’t seem to get the parser to allow me to do the "[*lang*]" trick. If that could be hacked into the parser you wouldn’t need the TV to run a separate sql query to identify the language of the document. It’s not a huge hit but ... one less query is always 1 less query laugh
          Tangent-Warrior smiley
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          Limiting the lang field to two characters may come back to haunt you; http://www.loc.gov/standards/iso639-2/langcodes.html and http://www.w3.org/International/articles/language-tags/
            Studying MODX in the desert - http://sottwell.com
            Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
            Join the Slack Community - http://modx.org
            • 4673
            • 577 Posts
            Thanks Susan!

            I was just thinking top domain type of thing.

            .ru
            .jp
            ect ...
            However, modifying the field wouldn’t be that big of a problem.

            so what do you think? I was just taking off from what you did laugh
              Tangent-Warrior smiley
              • 28042 ☆ A M B ☆
              • 24,524 Posts
              well, I would think at least five, for example en-uk or en-us.

              Maybe reading through this will help: http://www.ietf.org/rfc/rfc3066.txt

              It looks like a 2 or 3 letter tag, a dash, then up to eight characters in the second subtag. So you could go as far as 11 characters.

              Personally, I would go with five; if anybody wants to use i-klingon they can hack the database themelves! And in any case, a developer could simply use his own arbitrary designations if the standards don’t fit his requirements.
                Studying MODX in the desert - http://sottwell.com
                Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                Join the Slack Community - http://modx.org
                • 4673
                • 577 Posts
                now now now, some people really do speak klingon!
                I’m sure that there are a few here too!

                :)


                I wish I did! laugh
                  Tangent-Warrior smiley
                  • 7923
                  • 4,213 Posts
                  I think that japanese users would need 9 chars atleast... Look at this. So maybe just go with the toal 11 chars, what does it hurt.. laugh

                  EDIT: Oh, just remembered that you Carsten live in Japan, so I guess you know better lol grin


                    "He can have a lollipop any time he wants to. That's what it means to be a programmer."
                    • 4673
                    • 577 Posts
                    ahhh, ok, looks like my original idea is taking a different direction laugh

                    I was just thinking of a simple non-text encoding approach.

                    Just something simple.

                    ie: ja vs shift-jis (japanese example)



                    hmmm, which would work better for the largest share of users?
                      Tangent-Warrior smiley
                      • 28042 ☆ A M B ☆
                      • 24,524 Posts
                      I understand what you mean, but it’s still a good idea to make sure users will have as much flexibility in their useage as possible. Be sure if you don’t that you’ll have a dozen developers PMing you and posting with their complaints!
                        Studying MODX in the desert - http://sottwell.com
                        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                        Join the Slack Community - http://modx.org