We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 41825
    • 16 Posts
    I'd like to localize some settings and setting-descriptions for a chunk.

    I created a new namespace "mycomp", pointed the core_path to {core_path}components/mycomp/, created that folder, inside another folder "lexicon", and inside that one another folder "en". There I created a file "default.inc.php" with the following code in it:

    <?php
    $_lang['setting_mycomp.postUrl'] = 'Target-URL';
    $_lang['setting_mycomp.postUrl_desc'] = 'Where you want to post the form\'s data to.';


    I switched over to my chunk, added the setting "postUrl" and set "mycomp" as lexicon for that setting. Unfortunately, the setting doesn't get translated and still only shows up as "postUrl" in the manager.

    Am I missing something?
      • 4172
      • 5,888 Posts
      you have an single-quote inside a single-quoted string.
      This will not work.
      Try it like that:

      $_lang['setting_mycomp.postUrl_desc'] = "Where you want to post the form's data to.";


      And do you want to show your code, where you translate your settings in your chunk?
        -------------------------------

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!
        • 41825
        • 16 Posts
        Hi Bruno,

        found the typo, thanks. But still no luck :-/

        I don't want to translate the settings inside the chunk itself, I want that the MODX manager translates the settings for users who edit the chunk.
          • 3749
          • 24,544 Posts
          If I'm understanding you, a better method is to go into Lexicon Management, select the namespace, language, and topic, and change the string there. The change will be stored in the DB. It will override what's in the language file and it will survive upgrades.

            Did I help you? Buy me a beer
            Get my Book: MODX:The Official Guide
            MODX info for everyone: http://bobsguides.com/modx.html
            My MODX Extras
            Bob's Guides is now hosted at A2 MODX Hosting