We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 33175
    • 711 Posts
    All that seem super although I did not understand very well (English makes me default here) . embarrassed
      Sorry for my english. I'm french... My dictionary is near me, but it's only a dictionary !
      • 32241
      • 1,495 Posts
      It’s kinda hard for me to grasp the whole concept for now.
      I’m posting a reply, so I can see it on my new replies summary when there is a new post.
        Wendy Novianto
        [font=Verdana]PT DJAMOER Technology Media
        [font=Verdana]Xituz Media
        • 19726
        • 239 Posts
        Quote from: Djamoer at Mar 15, 2006, 05:59 PM

        I’m posting a reply, so I can see it on my new replies summary when there is a new post.
        A little OT: Djamoer you can also click the Notify link to get notified of new post to the topic.
          • 32241
          • 1,495 Posts
          Quote from: Mitch at Mar 16, 2006, 09:20 AM

          Quote from: Djamoer at Mar 15, 2006, 05:59 PM

          I’m posting a reply, so I can see it on my new replies summary when there is a new post.
          A little OT: Djamoer you can also click the Notify link to get notified of new post to the topic.

          Thanks for the tips. wink
            Wendy Novianto
            [font=Verdana]PT DJAMOER Technology Media
            [font=Verdana]Xituz Media
            • 17895
            • 209 Posts
            Hi all... it seems that modx community is moving! Unfortunately now it’s me that have no much time to spend on the ModX...

            Anyway... I saw a lot of people following the multi-table idea in this discussion... I am sorry but I do not agree so much to this idea... I do not see the need to create new tables for each language: also because this needs to create also "sibling" tables like meta tags, TV and so on...

            I come up with this idea because I wanted a site that was only PARTIALLY translated and I need to switch from the desired language to the default language each time the user arrives in a page that is not translated... if the pages are ALL translated, my solution is very similar to that of ... I do not remember, Susan Sotwell I think was her name... i.e. the trees of the documents are distinct from each other... they refer to each other (via the "parent" field) only if some translation is lacking...

            And, again, what do you think about snippets, modules and so on? they need to be changed in order to fit the multitable solution... and, unfortunately, they need to be changed also for my solution... anyway, for snippets and modules that "sees" the pages as an unordered list (for example search snippets or similar), do not need to be changed, because they see the pages without worry about the language field (they should be changed if a multi-table solution is taken)

            what do you think about this?
              Daniele "MadMage" Calisi
              • 33175
              • 711 Posts
              Multi table or one filed more is the same for all ressources : they must be modified in all cases.
              If we used multi tables, table name can be retrieved with
              $userId = $modx->getLoginUserID();
              $table = $modx->getFullTableName("user_messages").'_'.$_SESSION['lang'];
              $messages = $modx->db->select("subject, message, sender", $table, "recipient = $userId", "postdate DESC", "10");
              $modx->getFullTableName("xxxx");

              In the case of we use added field, we must add in the request a "where statement" as :
              $userId = $modx->getLoginUserID();
              $table = $modx->getFullTableName("user_messages");
              $messages = $modx->db->select("subject, message, sender", $table, "recipient = $userId and lang=$_SESSION['lang']", "postdate DESC", "10");
              $modx->getFullTableName("xxxx");

              There are no many difference to implement it.

              In your need, if you use two tables, you can use a sql request with "UNION" to get all records for content with different language.
              It is necessary to make a request for only 2 language tables of content because
              I need to switch from the desired language to the default language each time the user arrives in a page that is not translated
              $table_localized = $modx->getFullTableName("user_messages").'_'.$_SESSION['lang'];
              $table_default = $modx->db->select("manager_language", $modx->getFullTableName("setting_name"), "setting_name='system_settings'");
              $sql = "SELECT content FROM $table_default WHERE id=15 UNION SELECT content FROM $table_localized WHERE id=15";
              $result = $modx->db->query($sql);
              
              //  1st method
              if (mysql_num_rows($result)==1) {
                  $content = mysql_result ( $res, 0);
              }
              else {
                  $content = mysql_result ( $res, 1);
              }
              
              //  2nd method
              // if num rows == 2 then TRUE (1) (get the row number 1 to get the translated content)
              // else FALSE (0) (get the row number 0 to get the default content) 
              $content = mysql_result ( $res, mysql_num_rows($result)==2); 
              


              If you use one table for all :
              $table = $modx->getFullTableName("user_messages");
              $sql = "SELECT content FROM $table WHERE id=15 OR (parent=15 AND lang='fr')";
              $result = $modx->db->query($sql);
              
              //  1st method
              if (mysql_num_rows($result)==1) {
                  $content = mysql_result ( $res, 0);
              }
              else {
                  $content = mysql_result ( $res, 1);
              }
              
              //  2nd method
              // if num rows == 2 then TRUE (1) (get the row number 1 to get the translated content)
              // else FALSE (0) (get the row number 0 to get the default content) 
              $content = mysql_result ( $res, mysql_num_rows($result)==2); 
              

              There are no many difference to implement it.

              So, I always prefered multi tables for this reasons :
              Use of parent id in row translated to refer default row is not very clean : it permit to resolve the problem but parent id is not a field to make a link between different language.
              Smaller the tables are, more MySQL queries are fast. With multi table, MySQL parse one time a medium table for the first SELECT with a WHERE on one medium index and one time a small table for the SECOND with a WHERE on one small index. With one table, MySQL parse one time a big table with a WHERE on two big index with condition. At the release of version 4 of mysql, MySQL said that is faster to parse 2 medium tables with one index than to parse one table with 2 indexes. Maybe that changed....

              Your solution use simplier query than multi tables solution. It permit to answer to precise solution.
              Now if you want to use comments on other docments on your website, you need to hack UserComments to create a query as "select * from site_content where parent=15 and lang is null". Maybe other snippet require hacks.

              If one day, you want modify your site partially translated to site all translated, number of rows in site_content will grow up very fast and request to display content will make many much time.
              The first reason for me to prefered multi tables is possiblities of evolutions for the website in all directions. With it, you can create easly partially translated site, localized subsites or split the principal site (on one server) to several independent site (each site with its server).

              Off topic : several solutions exist to optimize sql => optimize database with tables (separate small fields and other, use of the smaller field possible, use adapted field type when is possible) and query (order of element in "where", use of small indexes or adapted indexes, use preferably numeric id). There are other optimisation possible but it’s too late for searching wink

              I’m not sur to be comprehensive. Ask me precision if need.

              Edit (2006-03-17 10 min later) : For optmize Modx to multi language content, it is necessary to modify database structure. And to optimize Modx it is also necessary wink
                Sorry for my english. I'm french... My dictionary is near me, but it's only a dictionary !
                • 6726
                • 7,075 Posts
                Nice to see that you’re still around, Madmage smiley

                I am beyond my skill set here but I think I get the logic behind the debate : pretty interresting !

                The question is : what do we do with this ? Multilingual content is one of the top priorities, does anyone lead the effort on this matter ?

                  .: COO - Commerce Guys - Community Driven Innovation :.


                  MODx est l'outil id
                  • 33175
                  • 711 Posts
                  does anyone lead the effort on this matter ?
                  Sorry, I don’t understand very well and google is not the ideal wink Could you explain it to me ?
                  Thanks
                    Sorry for my english. I'm french... My dictionary is near me, but it's only a dictionary !
                    • 32241
                    • 1,495 Posts
                    Quote from: Guillaume at Mar 16, 2006, 06:23 PM

                    does anyone lead the effort on this matter ?
                    Sorry, I don’t understand very well and google is not the ideal wink Could you explain it to me ?
                    Thanks

                    David is asking about who will be responsible in implementing this multi lingual features.

                    Btw Guillaume, I can see your point of creating multi tables for handling each language.
                    Here is what I have in mind.

                    If we need to replicate each chunk, site content, template variables, and templates, soon or later we will have a lot of tables filled up in the database. But considering that we are going to have only 2-4 translations at one site, so we need to have 8-16 tables to support the translation, compare to 4 tables, when we are not replicating the tables.

                    I don’t have a clear number about performance in here, but as far as I know, the more tables that we have on 1 database, the slower it gets for the database to proceed.

                    Now lets talk about the amount of rows needed. Lets say that each site usually contain 200 site contents, 5-15 template variables, which sum up as 1000-3000 rows, 1-5 templates, and 100-150 chunks. So if we want to duplicate into 4 languages without replicating table, here is the number of rows needed.
                    site contents: 800 rows
                    template variables: 4000-12000 rows
                    templates: 4-20 rows
                    chunks: 400-600 rows

                    we can see that the worst growth will be coming from TV, which causing the database to overload, but the site content and the rest will not be a problem in the long run. So it’s all depends on what we are aiming at. Another solution that we can use is to replicate column, instead of rows or tables. But this approach will not be a good solution for table with a lot of columns on it, but the best thing is, compare to rows duplication, we only need certain columns that requires translation to be duplicated, while in rows duplication, basically every columns will be duplicated.

                    Anyway, I’m not an expert, whichever the solution that you guys come up with, I’’m fine smiley
                      Wendy Novianto
                      [font=Verdana]PT DJAMOER Technology Media
                      [font=Verdana]Xituz Media
                      • 22303 MODX Staff
                      • 10,725 Posts
                      @davidm/all

                      Well then, I guess I am officially taking over the i18n efforts at this point -- efforts are already underway to achieve robust multi-lingual support, along with a few other surprises, in the next major release post 0.9.2. More details will be forthcoming, including a data model and a more complete explanation of what is being implemented; keep the ideas flowing, because all input is, as always, valuable and welcome.

                      I am also interested in getting as much detail as possible from those who have already implemented some type of multi-cultural solution with MODx, so I can be as thorough as possible in covering the wish list as well as all of the existing real-world requirements. If you’ve implemented a solution on your site, or want specific requirements considered in the core implementation beyond what has already been discussed, please feel free to post details here or contact me via PM.