We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 16545
    • 358 Posts
    One thing isn’t clear for me, how can I use a TVs for the product features with YAMS.
    Let’s say we have a products and some TVs features that we need to be translated too like color (red/blue/green/black) or some specific one.

    YAMS will create multilang TVs [*color_en/color_de/color_ru*] and default language is english.
    Question: how TVs like color_de and color_ru can get automatically translated value then I input a TV value for color_en?

      • 22851
      • 805 Posts
      Hmmm. Not 100% sure I understand exactly what you are asking. Would you like:

      a) a field that can take different values in each language?
      b) some text that is different in each language?
      or
      c) a combination of both?

      Anyway. Here’s how you accomplish all three:

      a) A field that can take different values in each language such as red, green or blue. A particular combination might be: en=red, de=blue, ru=green.

      You’ll need to create a custom multilingual template variable. To do this:

      1. Create color_en, color_de and color_ru template variables yourself. (YAMS doesn’t do this for you.)
      2. Make them all listboxes or similar, with the option format red||green||blue.
      3. Access the correct correct language value by placing
      [[YAMS? &get=`tv` &from=`color`]]

      in your document.

      b) Some text that is different in each language. For example, en=red, de=rot, ru=красный.

      There are two options here.

      1. The simplest, is to use a YAMS snippet call of the form:
      [[YAMS? &get=`text` &from=`en::red||de::rot||ru::красный`]]


      2. The second option (which may be better for larger quantities of text or text containing special characters) is to create chunks called red_en containing red, red_de containing rot and red_ru containing красный and to use the YAMS snippet call:
      [[YAMS? &get=`chunk` &from=`red`]]


      c) A combination of both. The options red, green or blue should be available in each language, but the text should be appropriately translated. A particular combination might be en=red, de=blau, ru=зеленый.

      Do as for a) except for the option format use red||green||blue for color_en, rot||grün||blau for color_de and красный||зеленый||синий for color_ru.

      (I used Google translate for the Russian, so apologies it there were any errors.)

      Hope that helps.
        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.
        • 16545
        • 358 Posts
        Great explanation, in my case it will be the second one from your examples.
        Powerful!!!
          • 14404
          • 84 Posts
          Is it me or doesn’t this work anymorec

          I’m trying to have a multilingual TV named ’newsletter’

          i made the TV’s newsletter_en and newsletter_nl
          yams tabify’s it in to the right place and i can add whatever i want to the right document/language.. but when i wanna see it in the front-end it doesnt show anything.. what to do?

          iv put [[YAMS? &get=`tv` &from=`newsletter_en`]] in the document, same goes for the nl but it doesnt show anything.. what to do huh
            • 22851
            • 805 Posts
            Quote from: Joeeeeh at Feb 03, 2010, 09:45 AM

            iv put [[YAMS? &get=`tv` &from=`newsletter_en`]] in the document, same goes for the nl but it doesnt show anything.. what to do huh

            Sorry this is a bit late... Please use [tt][[YAMS? &get=`tv` &from=`newsletter`]][/tt]. YAMS will figure out the correct language tv to use.
              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.
              • 14404
              • 84 Posts
              Still doesn’t work to me? Why do u need to use that code to get an output anyway? because like, the TV’s are already assigned to the page in the correct language? only problem is that in the front-end it doesn’t show anything? What am i missing?
                • 22851
                • 805 Posts
                If you want to access the correct language variant of the template variable from within the document template, then you must use the snippet call, since this will figure out which language to output for you.

                If, on the other hand, you want to place the template variable within a multilingual content field in a given document you can use the snippet call if you want, but it’s not necessary: You already know that the English tv will need to go in the English content field so you could just use [*newsletter_en*] directly. Likewise for the other languages. This reduces the amount of processing required by YAMS a little.

                So, what are the contents of [*newsletter_en*] in your case? If you place [*newsletter_en*] in your English content field, or even in your document template, what output to you get? If you get nothing then this suggests that the problem is with the contents of your template variable rather than YAMS.
                  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.
                  • 14404
                  • 84 Posts
                  Well.. So i made the TV’s [*newsletter_en*], [*newsletter_nl*], [*newsletter_de*] and [*newsletter_fr*].

                  My template has the code [*newsletter*]

                  if i put [*newsletter_en*] in the content field i get this error:

                  Fatal error: Maximum execution time of 30 seconds exceeded in /manter/web/test/assets/modules/yams/class/yams.class.inc.php on line 6701

                  What is the snippet call ur talking about? what do i need to do?
                    • 22851
                    • 805 Posts
                    Hmm. That’s not good. Is your site on line so that I can log in and take a look at it? If so, please send me a personal message with the details.
                      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.
                      • 14404
                      • 84 Posts
                      PM send’

                      btw, now ur reading this anyway.. could u maybe make an example of this (http://modxcms.com/forums/index.php/topic,44716.0.html) in a hidden document? I can’t get this to work either for some reason..

                      thanks for helping!