We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 9207 ☆ A M B ☆
    • 2,475 Posts
    I’m working through the page here: http://svn.modxcms.com/docs/display/revolution/Internationalization

    And I wanted to make sure I’m understanding this correctly.... if I’m a 3rd party developer, I should prepend my own prefix to my language keys, e.g.

    $_lang['my-component.some-key'] = 'my translation';


    Right?

    I was confused because the examples there also use a settings_ prefix. Is that special? Or is this just a typo? E.g.

    $_lang['setting_gallery.display_thumbs']


    Should that actually read:

    $_lang['gallery.display_thumbs']


    (assuming that it’s belongs to a "gallery" component?)

    Thanks.
      • 28215
      • 4,149 Posts
      Quote from: Everett at Apr 29, 2010, 11:41 AM

      And I wanted to make sure I’m understanding this correctly.... if I’m a 3rd party developer, I should prepend my own prefix to my language keys, e.g.
      $_lang['my-component.some-key'] = 'my translation';

      Right?
      Correct.


      I was confused because the examples there also use a settings_ prefix. Is that special? Or is this just a typo? E.g.
      $_lang['setting_gallery.display_thumbs']

      Should that actually read:
      $_lang['gallery.display_thumbs']

      (assuming that it’s belongs to a "gallery" component?)
      Thanks.

      No - this should be doc’ed in a 3PC tutorial, I think, but if you want to add translatability to your custom Settings for your 3PC, you’d prefix it with the ’setting_’ prefix. IOW, for a custom setting called ’gallery.display_thumbs’, you’d need 2 lexicon entries (one for setting name, one for description):

      $_lang[’setting_gallery.display_thumbs’];
      $_lang[’setting_gallery.display_thumbs_desc’];
        shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
        • 9207 ☆ A M B ☆
        • 2,475 Posts
        Ok, I think I’m needing more clarification now...

        So the settings_ prefix is special in the world of _lang keys... but what exactly does it do?

        And the _desc suffix is also special, yes? But what exactly does it do?

        So really, we’re talking about something like


        $_lang[ $key ] = ’Translations’;

        Where:
        $key = ’optional special_ prefix’ . ’optional-component-name.’ . ’lexicon_key’;

        Is that correct?
          • 28215
          • 4,149 Posts
          Quote from: Everett at Apr 29, 2010, 05:09 PM

          So the settings_ prefix is special in the world of _lang keys... but what exactly does it do?
          And the _desc suffix is also special, yes? But what exactly does it do?

          Yes, it’s special in the sense that when the Settings grids (system,context,user) encounter a Setting that has a namespace other than ’core’, they attempt to:

          - Load the ’namespace:default’ topic.
          - If loaded, then look for the setting with key: ’setting_[key]’ for the name, and ’setting_[key]_desc’ for the description.

          So, if you had a Setting with a key of ’myextra.use_secure’, then it would:
          - Attempt to load the ’myextra:default’ topic
          - If loaded, look for Lexicon Entries with keys:
          -- ’setting_myextra.use_secure’ for the translation of the name of the setting
          -- ’setting_myextra.use_secure_desc’ for the translation of the description of the setting


          So really, we’re talking about something like
          $_lang[ $key ] = ’Translations’;
          Where:
          $key = ’optional special_ prefix’ . ’optional-component-name.’ . ’lexicon_key’;
          Is that correct?

          No, wait. 99% of custom lexicon entries should be: $_lang[’comp_prefix.entry_key’];

          The only special ones are ones that deal with Settings.
            shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
            • 9207 ☆ A M B ☆
            • 2,475 Posts
            You lost me a bit on that... I think I’ll have to understand settings more before I understand how these language keys are interacting with them / vice versa.