We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 8489
    • 90 Posts
    I have 3 contexts (web) (en) and (de) all context have different templates:
    (web) has template "Web Template"
    (en) has template "EN Template"
    (de) has template "DE Template"

    When you create a translation with the "Create translation" button from the Babel Extra it takes the template from the context from where you create the translation.

    So when you create a translation via (web) context for (en) context, It gives the created translation the template "Web Template" but I would like it to give it the template "EN Template"

    Is this possible?

      • 21838
      • 284 Posts
      You might have to edit the plugin here:
      					$newResource = $babel->duplicateResource($resource, $contextKey);
      					if($newResource) {										
      						$linkedResources[$contextKey] = $newResource->get('id');
      						$babel->updateBabelTv($linkedResources, $linkedResources);
      					} else {
      						/* error: translation could not be created */
      						$errorParameter = array('context' => $contextKey);
      						throw new Exception('error.could_not_create_translation');
      					}
      

      It only duplicates (with all settings) the resource.
        MODX Free Template Base: MODX-Boilerplate | my blog (lots of MODX stuff) | my gitHub (translations) | MODX User Groups Germany (Facebook)
        • 8489
        • 90 Posts
        Thanks Novolo, I also posted to Mikrobi at his blog maybe he will make it work in future releas.
          • 18373 ☆ A M B ☆
          • 3,141 Posts
          What’s the differences in those templates?

          Perhaps you can make clever use of context settings or lexicons to narrow it down to just one template? Context setting for a logo for example.
            Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

            Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.
            • 8489
            • 90 Posts
            Mostly headers and footers and some getResourceField with tv’s per language context
              • 33976 ☆ A M B ☆
              • 571 Posts
              I would second Mark here, you can do it like
              [[$nav-[[!++cultureKey]]]]
              …
              [[$footer-[[!++cultureKey]]]]
              

                • 8489
                • 90 Posts
                Thanks Guys!
                  • 19604 ☆ A M B ☆
                  • 179 Posts
                  Use the lexicon, like:
                  [[%key? &topic=`topicname` &namespace=`namespace_name` &language=`en`]]

                  Example long:
                  [[%welcome? &topic=`messages` &namespace=`myprojectname` &language=`en`]]

                  Change the cultureKey system setting with a plugin binded to "OnInitCulture" and you can drop the "&language=". You can forget about "&topic=" if you do nat have a large number of entries which need to have a little organisation.

                  Example short:
                  [[%welcome? &namespace=`myprojectname`]]

                  For "en" you set the value to: "Welcome!"
                  For "de" you set the value to: "Willkommen!"

                  More in the docs (http://rtfm.modx.com/display/revolution20/Internationalization)

                  best
                  Oliver
                    MINDEFFECTS – DESIGN for PRINT, WEB and MEDIA
                    http://twitter.com/mindeffects · http://www.facebook.com/mindeffects · http://www.youtube.com/mindeffects/ · skype://mindeffects_oliver