We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 22851
    • 805 Posts
    bjan. Both burn and myself both have YAMS working within a subdirectory now. Did you get it working too?
      YAMS: Yet Another Multilingual Solution for MODx
      YAMS Forums | Latest: YAMS 1.1.9 | YAMS Documentation
      Please consider donating if you appreciate the time and effort spent developing and supporting YAMS.
      • 22851
      • 805 Posts
      Dear all.

      I’d like to start maintaining a list of sites implementing or starting to test and implement YAMS, along with some additional info along the lines of:

      • Status: Installed|Translation in progress|Site live|...
      • Site: (If live.)
      • Setup/Configuration: Server mode|Root name mode|Query param mode|Subdirectory|...
      • Multilingual snippets and features: Wayfinder, Ditto, eForm, RSS feeds, Site Map,...
      By keeping the list up to date I can then use it to decide when YAMS has been sufficiently tested and stable to bring out of alpha and make into a beta that people will have more confidence in and that can be more widely publicised. I appreciate that the list might currently be very small, but hopefully it will slowly but steadily grow, particularly as I attempt to respond to feedback on useful features and improvements to the documentation.

      So, let me kick this off:

      • Status: Site live
      • Site: Nashi Power
      • Setup/Configuration: Root name mode. Start page based on browser language settings.
      • Multilingual snippets and features: Wayfinder, Ditto site list, eForm, RSS feeds (one per language), Single XML Site map (listing pages from all languages)
      People can post their updates here and I’ll maintain the master list on the first post of the thread.
        YAMS: Yet Another Multilingual Solution for MODx
        YAMS Forums | Latest: YAMS 1.1.9 | YAMS Documentation
        Please consider donating if you appreciate the time and effort spent developing and supporting YAMS.
        • 22851
        • 805 Posts
        Version 1.0.3 alpha RC3 of YAMS is now available for download from my server.

        This version has a new feature. It is no longer necessary to replace all your MODx internal URLs ([~2~] or [(site_url)][~2~] for example) by YAMS placeholders like (yams_doc:2) or (yams_docr:2). (Using YAMS placeholders does no harm though.) This will now be handled automatically by YAMS. As a result, the URL that appears within the document output will automatically point to the correct language version of the page. The URLs that YAMS outputs are also configurable. From the ’Other Params’ tab it is possible to specify that the alias is not output for the site start page, and it is also possible to request that YAMS resolves weblinks and displays the final destination URL rather than using the alias of the weblink.

        There was also a change to the format accepted by one of the snippet parameters. If anyone has been inserting code like
        [[YAMS? &get=`text` &from=`en:hello|fr:bonjour|ja:こんにちは|gr:γειά σου`]]
        

        into their templates, then this should now be replaced by
        [[YAMS? &get=`text` &from=`en::hello||fr::bonjour||ja::こんにちは||gr::γειά σου`]]
        

          YAMS: Yet Another Multilingual Solution for MODx
          YAMS Forums | Latest: YAMS 1.1.9 | YAMS Documentation
          Please consider donating if you appreciate the time and effort spent developing and supporting YAMS.
          • 22851
          • 805 Posts
          Quote from: jonimant at Aug 02, 2009, 01:03 PM

          The document for each language is calling:

          [[Ditto? &tpl=`news` &sortBy=`createdon` &summarize=`5` &dateFormat=`%d.%m.%Y` &truncText=`>>` &paginate=1 &language=`(yams_mname)`]]

          and displays an error:

          Language file does not exist Please check: ..../assets/snippets/ditto/lang/russian-UTF8.inc.php


          jonimant.

          I have been able to reproduce the problem. I can offer a few workarounds until I fix it.

          1. Run your snippet call as uncacheable eg: [!Ditto? ... !].
          2. If your ditto snippet call is in the content field of a document, specify the language directly on each language tab. eg: &language=`russian-UTF8`
          3. If your ditto snippet call appears within the document template and you need it to function correctly for each language, then create several chunks named dittocall_en, dittocall_ru, etc... Place one ditto call in each chunk, specifying the language directly in each case. eg: &language=`russian-UTF8`, &language=`english`, etc. Then, in your document template use
          [[YAMS? &get=`chunk` &from=`dittocall`]]
          so that YAMS picks the correct language ditto call.

          Please note that to make ditto function correctly with multilingual content you will have to use the YAMS extender. So, your Russian ditto call should be:
          [[Ditto? &tpl=`news` &sortBy=`createdon` &summarize=`5` &dateFormat=`%d.%m.%Y` &truncText=`>>` &paginate=1 &language=`russian-UTF8` &extenders=`@FILE assets/modules/yams/yams.extender.inc.php`]]
          
            YAMS: Yet Another Multilingual Solution for MODx
            YAMS Forums | Latest: YAMS 1.1.9 | YAMS Documentation
            Please consider donating if you appreciate the time and effort spent developing and supporting YAMS.
            • 14653
            • 24 Posts
            Chunk call from [[YAMS? &get=`chunk` &from=`dittocall`]] did not help.
            No results.
            There are problems with the placeholders [+ previous +] [+ pages +] [+ next +] when calling:

            <p>[[Ditto? &tpl=`news` &sortBy=`createdon` &summarize=`5` &dateFormat=`%d.%m.%Y` &truncText=`>>` &paginate=1 &language=`engilish`]]</p>
            <p>Showing [+start+] - [+stop+] of [+total+] Articles</p>
            <p>Pages.: [+previous+] [+pages+] [+next+]</p>

            Example:[+next+] = http://example.com/news?yams_lang=en&start=5
            Clicking this link will be made to redirect to default language, in my example, the transition will be made http://example.com/news?yams_lang=ru&start=5
              Sys. info:
              MODx version: MODx Revolution 2.x
              OS: Archlinux roller
              • 22851
              • 805 Posts
              Quote from: jonimant at Aug 02, 2009, 07:22 PM

              Chunk call from [[YAMS? &get=`chunk` &from=`dittocall`]] did not help.
              No results.
              I’ll investigate this tonight and get back to you. (About 8 hours from now for me.)

              Quote from: jonimant at Aug 02, 2009, 07:22 PM

              There are problems with the placeholders [+ previous +] [+ pages +] [+ next +] when calling:

              <p>[[Ditto? &tpl=`news` &sortBy=`createdon` &summarize=`5` &dateFormat=`%d.%m.%Y` &truncText=`>>` &paginate=1 &language=`engilish`]]</p>
              <p>Showing [+start+] - [+stop+] of [+total+] Articles</p>
              <p>Pages.: [+previous+] [+pages+] [+next+]</p>

              Example:[+next+] = http://example.com/news?yams_lang=en&start=5
              Clicking this link will be made to redirect to default language, in my example, the transition will be made http://example.com/news?yams_lang=ru&start=5

              Note that &language=`english` is spelt incorrectly in your example above. I don’t think that is the problem however. As with the other issue, I wont be able to look into it until this evening I’m afraid. It might be easiest if I could log into your MODx install and investigate instead of trying to replicate your setup on my own test box. If you are happy to allow me to do that, then please send me a personal message with the login details and address.

              Thanks.
                YAMS: Yet Another Multilingual Solution for MODx
                YAMS Forums | Latest: YAMS 1.1.9 | YAMS Documentation
                Please consider donating if you appreciate the time and effort spent developing and supporting YAMS.
                • 22851
                • 805 Posts
                Hi again jonimant

                Thanks for sending me a PM with a login to your site. I’m really impressed with your site and the extent to which you have used YAMS already! Here are a couple of general hints/pointers:

                1. I noticed that you use ’Default’ as your redirection mode. That means that anyone browsing to http://www.mysite.com/ will automatically be redirected to your default language, which is Russian. In your case that will be http://www.mysite.com/ru/

                You might like to set it to ’Browser’. In that case people will be redirected to a language page that matches their browser settings if possible. So, I would automatically be redirected to the English root. http://www.mysite.com/en/

                2. I noticed that you use code like this:
                [[YAMS? &get=`content` &from=`content` &docid=`[*id*]`]]
                

                to get the content field in the correct language for the current page within your document template. That’s fine, but YAMS is actually intelligent enough to understand normal MODx document variables. So you could have just used
                [*content*]
                

                like in normal MODx templates. If you use the latest version of YAMS from my server, version 1.0.3 alpha RC3 then you hardly have to modify your document templates at all, since even URLs are handled automatically.

                3. I noticed that your normal document variables are still visible when editing your multilingual documents. However, these are redundant for multilingual templates, since you have multilingual variants on the other tabs. Once you have finished translation you can hide the redundant ones by selecting the Hide Redundant Fields option on the Other Params tab.

                4. I noticed that in your ditto templates you are using code like
                [[YAMS? &get=`content` &docid=`[+id+]` &from=`pagetitle`]]

                to get the pagetitle of the current page being read by ditto.

                While that is a general method that will work with any template, there is an easier ay with ditto. If you use the ditto extender that I have written then you can use a normal ditto placeholders instead. So in this case you would just write
                [+pagetitle+]

                like normal.
                To use the ditto extender, just add &extenders=`@FILE assets/modules/yams/yams.extender.inc.php` to your snippet call as mentioned previously.

                Now to the real issues:

                Quote from: PMS at Aug 03, 2009, 04:14 AM

                Quote from: jonimant at Aug 02, 2009, 07:22 PM

                Chunk call from [[YAMS? &get=`chunk` &from=`dittocall`]] did not help.
                No results.
                I’ll investigate this tonight and get back to you. (About 8 hours from now for me.)
                I just checked this out and it worked for me. I took a look at your site and I noticed that you only had one dittocall chunk. Actually you need one for each language like so

                dittocall_en:
                [[Ditto? &tpl=`news` &sortBy=`createdon` &summarize=`5` &dateFormat=`%d.%m.%Y` &truncText=`>>` &paginate=1 &language=`english` &extenders=`@FILE assets/modules/yams/yams.extender.inc.php`]]

                dittocall_ru:
                [[Ditto? &tpl=`news` &sortBy=`createdon` &summarize=`5` &dateFormat=`%d.%m.%Y` &truncText=`>>` &paginate=1 &language=`russian-UTF8` &extenders=`@FILE assets/modules/yams/yams.extender.inc.php`]]

                etc.

                Then the snippet call [[YAMS? &get=`chunk` &from=`dittocall`]] should work.

                Quote from: jonimant at Aug 02, 2009, 07:22 PM

                There are problems with the placeholders [+ previous +] [+ pages +] [+ next +] when calling:

                <p>[[Ditto? &tpl=`news` &sortBy=`createdon` &summarize=`5` &dateFormat=`%d.%m.%Y` &truncText=`>>` &paginate=1 &language=`engilish`]]</p>
                <p>Showing [+start+] - [+stop+] of [+total+] Articles</p>
                <p>Pages.: [+previous+] [+pages+] [+next+]</p>

                Example:[+next+] = http://example.com/news?yams_lang=en&start=5
                Clicking this link will be made to redirect to default language, in my example, the transition will be made http://example.com/news?yams_lang=ru&start=5

                I have managed to reproduce the problem. I am not surprised that these ditto placeholders don’t work, since ditto and its extenders know nothing about YAMS and multilingual URLs. It surprises me therefore, that I see yams_lang=en in the URL - since that comes from YAMS somehow, and URLs of this form are normally only output in query param mode, but YAMS is not in that mode. So, there might be a YAMS bug somewhere.

                I am going to have to look into the paginate or summarise (or whatever it is called) ditto extender to see what it is doing. In the worst case scenario (and this is quite likely) it might be necessary to create a YAMS version of the extender that will output YAMS compatible URLs. Please leave it with me and I will investigate what needs to be done. I can’t promise that I will be able to come up with an immediate solution because quite a bit of work might be involved.

                Can you avoid using ditto placeholders for the time being?

                Finally, would you mind if I publicise your site and the fact that it uses YAMS by adding it to the table on the first post of this thread?
                  YAMS: Yet Another Multilingual Solution for MODx
                  YAMS Forums | Latest: YAMS 1.1.9 | YAMS Documentation
                  Please consider donating if you appreciate the time and effort spent developing and supporting YAMS.
                  • 22851
                  • 805 Posts
                  One additional observation.

                  I noticed that you were using a FormatDate snippet call within your ditto template to format the date of your editedon placeholder. However, you could just add &dateSource=`editedon` to your ditto call and the fact that you have already specified &dateFormat=`%d.%m.%Y` would mean that it would just work.
                    YAMS: Yet Another Multilingual Solution for MODx
                    YAMS Forums | Latest: YAMS 1.1.9 | YAMS Documentation
                    Please consider donating if you appreciate the time and effort spent developing and supporting YAMS.
                    • 22851
                    • 805 Posts
                    Quote from: PMS at Aug 03, 2009, 04:17 PM

                    Quote from: jonimant at Aug 02, 2009, 07:22 PM

                    There are problems with the placeholders [+ previous +] [+ pages +] [+ next +] when calling:

                    <p>[[Ditto? &tpl=`news` &sortBy=`createdon` &summarize=`5` &dateFormat=`%d.%m.%Y` &truncText=`>>` &paginate=1 &language=`engilish`]]</p>
                    <p>Showing [+start+] - [+stop+] of [+total+] Articles</p>
                    <p>Pages.: [+previous+] [+pages+] [+next+]</p>

                    Example:[+next+] = http://example.com/news?yams_lang=en&start=5
                    Clicking this link will be made to redirect to default language, in my example, the transition will be made http://example.com/news?yams_lang=ru&start=5

                    I have managed to reproduce the problem. I am not surprised that these ditto placeholders don’t work, since ditto and its extenders know nothing about YAMS and multilingual URLs. It surprises me therefore, that I see yams_lang=en in the URL - since that comes from YAMS somehow, and URLs of this form are normally only output in query param mode, but YAMS is not in that mode. So, there might be a YAMS bug somewhere.

                    I am going to have to look into the paginate or summarise (or whatever it is called) ditto extender to see what it is doing. In the worst case scenario (and this is quite likely) it might be necessary to create a YAMS version of the extender that will output YAMS compatible URLs. Please leave it with me and I will investigate what needs to be done. I can’t promise that I will be able to come up with an immediate solution because quite a bit of work might be involved.

                    Can you avoid using ditto placeholders for the time being?

                    Hi again.

                    On further investigation I came across a simple solution that doesn’t require re-writing the pagination extender (phew!):

                    1. Run the ditto call as uncacheable [!Ditto ... !]. This is always necessary when you do pagination with ditto.

                    2. You have to understand that YAMS works by embedding multiple language versions into a single document, which effectively means that there are multiple ditto calls. Since there are multiple ditto calls, you need to use the Ditto &id parameter and give all ditto placeholders a {id}_ prefix. Finally, you can use just one ditto call (no need for all that dittocall chunk business) and one set of placeholders and it will all work (almost):

                    [!Ditto? &id=`(yams_id)` &tpl=`news` &sortBy=`createdon` &summarize=`5` &dateSource=`editedon` &dateFormat=`%d.%m.%Y` &truncText=`>>` &paginate=1 &language=`(yams_mname)` &extenders=`@FILE assets/modules/yams/yams.extender.inc.php`!]
                    <p>Showing [+(yams_id)_start+] - [+(yams_id)_stop+] of [+(yams_id)_total+] Articles</p>
                    <p>Pages.: [+(yams_id)_previous+] [+(yams_id)_pages+] [+(yams_id)_next+]</p>
                    


                    3. The next thing to understand is that ditto knows nothing about YAMS and mulitple language versions of the document. So, it outputs *normal* URLs. Since there are different language versions of the same page, YAMS will redirect to one of the valid language variants. Which one depends on the redirection mode. I advised earlier to use ’Browser’ mode. However, if you want to use pagination then it is more appropriate to use ’Current’ mode. In current mode, YAMS redirects to the language of the last visited multilingual page (uses a cookie to track), or the default language otherwise.

                    So, use ’Current’ mode and you will stay in the current language when you click on the prev and next links etc.

                    I have this working on my test setup.

                    EDIT: Corrected an error: (yams_lang) => (yams_id)
                      YAMS: Yet Another Multilingual Solution for MODx
                      YAMS Forums | Latest: YAMS 1.1.9 | YAMS Documentation
                      Please consider donating if you appreciate the time and effort spent developing and supporting YAMS.
                      • 14653
                      • 24 Posts
                      Quote from: PMS at Aug 03, 2009, 04:17 PM

                      Hi again jonimant

                      Thanks for sending me a PM with a login to your site. I’m really impressed with your site and the extent to which you have used YAMS already! Here are a couple of general hints/pointers:

                      1. I noticed that you use ’Default’ as your redirection mode. That means that anyone browsing to http://www.mysite.com/ will automatically be redirected to your default language, which is Russian. In your case that will be http://www.mysite.com/ru/

                      You might like to set it to ’Browser’. In that case people will be redirected to a language page that matches their browser settings if possible. So, I would automatically be redirected to the English root. http://www.mysite.com/en/

                      2. I noticed that you use code like this:
                      [[YAMS? &get=`content` &from=`content` &docid=`[*id*]`]]
                      

                      to get the content field in the correct language for the current page within your document template. That’s fine, but YAMS is actually intelligent enough to understand normal MODx document variables. So you could have just used
                      [*content*]
                      

                      like in normal MODx templates. If you use the latest version of YAMS from my server, version 1.0.3 alpha RC3 then you hardly have to modify your document templates at all, since even URLs are handled automatically.

                      thanks did not know. that it works

                      3. I noticed that your normal document variables are still visible when editing your multilingual documents. However, these are redundant for multilingual templates, since you have multilingual variants on the other tabs. Once you have finished translation you can hide the redundant ones by selecting the Hide Redundant Fields option on the Other Params tab.


                      4. I noticed that in your ditto templates you are using code like
                      [[YAMS? &get=`content` &docid=`[+id+]` &from=`pagetitle`]]

                      to get the pagetitle of the current page being read by ditto.

                      While that is a general method that will work with any template, there is an easier ay with ditto. If you use the ditto extender that I have written then you can use a normal ditto placeholders instead. So in this case you would just write
                      [+pagetitle+]

                      like normal.
                      To use the ditto extender, just add &extenders=`@FILE assets/modules/yams/yams.extender.inc.php` to your snippet call as mentioned previously.


                      does not work, it displays an error: @FILE:assets/modules/yams/yams.extender.inc.php extender does not exist. Please check it.
                      Now to the real issues:

                      Quote from: PMS at Aug 03, 2009, 04:14 AM

                      Quote from: jonimant at Aug 02, 2009, 07:22 PM

                      Chunk call from [[YAMS? &get=`chunk` &from=`dittocall`]] did not help.
                      No results.
                      I’ll investigate this tonight and get back to you. (About 8 hours from now for me.)
                      I just checked this out and it worked for me. I took a look at your site and I noticed that you only had one dittocall chunk. Actually you need one for each language like so

                      dittocall_en:
                      [[Ditto? &tpl=`news` &sortBy=`createdon` &summarize=`5` &dateFormat=`%d.%m.%Y` &truncText=`>>` &paginate=1 &language=`english` &extenders=`@FILE assets/modules/yams/yams.extender.inc.php`]]

                      dittocall_ru:
                      [[Ditto? &tpl=`news` &sortBy=`createdon` &summarize=`5` &dateFormat=`%d.%m.%Y` &truncText=`>>` &paginate=1 &language=`russian-UTF8` &extenders=`@FILE assets/modules/yams/yams.extender.inc.php`]]

                      etc.

                      Then the snippet call [[YAMS? &get=`chunk` &from=`dittocall`]] should work.

                      Quote from: jonimant at Aug 02, 2009, 07:22 PM

                      There are problems with the placeholders [+ previous +] [+ pages +] [+ next +] when calling:

                      <p>[[Ditto? &tpl=`news` &sortBy=`createdon` &summarize=`5` &dateFormat=`%d.%m.%Y` &truncText=`>>` &paginate=1 &language=`engilish`]]</p>
                      <p>Showing [+start+] - [+stop+] of [+total+] Articles</p>
                      <p>Pages.: [+previous+] [+pages+] [+next+]</p>

                      Example:[+next+] = http://example.com/news?yams_lang=en&start=5
                      Clicking this link will be made to redirect to default language, in my example, the transition will be made http://example.com/news?yams_lang=ru&start=5

                      I have managed to reproduce the problem. I am not surprised that these ditto placeholders don’t work, since ditto and its extenders know nothing about YAMS and multilingual URLs. It surprises me therefore, that I see yams_lang=en in the URL - since that comes from YAMS somehow, and URLs of this form are normally only output in query param mode, but YAMS is not in that mode. So, there might be a YAMS bug somewhere.

                      I am going to have to look into the paginate or summarise (or whatever it is called) ditto extender to see what it is doing. In the worst case scenario (and this is quite likely) it might be necessary to create a YAMS version of the extender that will output YAMS compatible URLs. Please leave it with me and I will investigate what needs to be done. I can’t promise that I will be able to come up with an immediate solution because quite a bit of work might be involved.

                      Can you avoid using ditto placeholders for the time being?

                      Finally, would you mind if I publicise your site and the fact that it uses YAMS by adding it to the table on the first post of this thread?
                        Sys. info:
                        MODx version: MODx Revolution 2.x
                        OS: Archlinux roller