We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 4673
    • 577 Posts
    hehe, here I’ve been working away on a template port and then it dawned on me ... tongue

    Why can’t you just hack the db a little and add in another dropdown on the page settings page to include a selection for which language and have it default to english (or well you know!)

    Then you could just run TV checks and all that other great ModX magic knowing that you have a set variable to depend upon rather than going throught he hassles of using a cookie! (no offense to Susan here!)
      Tangent-Warrior smiley
    • That sounds like a good option for those that want to use it. Why don’t you whip that up and we’ll take a look. :p
        Ryan Thrash, MODX Co-Founder
        Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
        • 33337
        • 3,975 Posts
        Sounds really interesting! Though I dont have experience with multiligual stuff, but ... still smiley
          Zaigham R - MODX Professional | Skype | Email | Twitter

          Digging the interwebs for #MODX gems and bringing it to you. modx.link
        • One of the exceptions to this is that if the language in the Manager is different to that of the intended audience of the site.

          We can’t assume that the end user of the site will use the same language of the administrator(s). In this case, frontend management of languages (ie. allowing the user to select which language they want) is a must.

          I don’t have a immediate solution ... I am thinking on it, but it is a can of worms to deal with.

          Just my 2c anyway
            Garry Nutting
            Senior Developer
            MODX, LLC

            Email: [email protected]
            Twitter: @garryn
            Web: modx.com
            • 4673
            • 577 Posts
            I’m thinking of the front end (end user) not the manager side. The manager side is essentially multi-lingual since you can add lanaguages to it (however, it’s not the quick switch type or possibly might not be able to have to people logged in at the same time using diferent languages but that is another issue).

            I am thinking at the moment that being able to have templates declared for a document that might be jsut as easy to have a language declared too.

            Now, combine this with Susan’s idea of having different "language folders" you wouldn’t have to use a cookie to check which language the end-user is using.

            I am not referring to a truer multi-lingual type like postnuke or similar system. I do like the postnuke system because you can turn blocks on and off according to language.

            However, I can see the possibility of running across cultural issues of colors/designs/and such although, I think that the web has grown up enough these days that such issues are going to become less and less.

            Anyway, I was just thinking that this could be a simple hack while the larger "can of worms" gets looked into.

            cheers
              Tangent-Warrior smiley
            • Ah, I see now smiley My bad, I read your original message wrong ... <note to self>Don’t reply to messages when I’m sleep deprived</note to self>

              Now, combine this with Susan’s idea of having different "language folders" you wouldn’t have to use a cookie to check which language the end-user is using.
              Yeah, I can see the benefits in having page-level language settings, would be a neat interim solution.

              Cheers,

              Garry
                Garry Nutting
                Senior Developer
                MODX, LLC

                Email: [email protected]
                Twitter: @garryn
                Web: modx.com
                • 4673
                • 577 Posts
                Ok, just a quick update:
                I’m still playing with this so let’s keep this as an idea based thread for a bit.

                1,) add an extra column to the site_content column:
                name of field: lang
                type: char(2)
                default: en

                I went with letters since I was thinking that it would be easier to remember compared to what language is what number? was it 1,2 or 4 huh
                also, might be easier to pull from a domain list ... .jp, .ru, .us ... etc .. anyway, there aren’t going to be that many main languages are there?

                here is a TV that I’ve been playing with on the multiflex1 type that I ported and posted here.

                @EVAL
                global $modx;
                $id = $modx->documentIdentifier;
                $tbl = $modx->dbConfig[' DB----NAME---GOES HERE! ']."modx_site_content";
                $result = $modx->db->getValue("SELECT lang FROM ". $tbl ." WHERE id = " . $id);
                $lang =  $result;
                
                If ( $lang == 'jp' ) {
                $LanguageMenuSelector = '@CHUNK mfHeader_Japanese';
                } elseIf ( $lang == 'en' ) {
                $LanguageMenuSelector = '@CHUNK mfHeader_English';
                } elseIf ( $lang == 'ru' ) {
                $LanguageMenuSelector = '@CHUNK mfHeader_Russian';
                } else {}
                
                return $LanguageMenuSelector;
                


                Pretty cool since my pages seem to be parsing a bit quicker than with the previous cookie call I was using, also, I don’t have any troubles with switching between languages and seeing the previously seleceted language menu -- this bit of problem is more than likely my sh_tty coding laugh


                As for working from the admin side.
                Sorry folks but currently everything is being done from phpmyadmin.

                However, I did duplicate a document and saw that the new document carried over the field "lang". I haven’t tried from a new document but I imagine that the result variable will just return "0" or something like that tongue

                I would like to be able to call this like the static variables like id, pagetitle and content but I’m still lost in the core code for modx at the moment. However, if this were added to the core then we’d be able to call the variable much easier and wouldn’t need to add the extra query to the page shocked

                Can somebody lead me in the right direction?

                Cheers and have fun!
                  Tangent-Warrior smiley