We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
  • We have a site that uses multiple contexts. One site may be in English, while another is in Spanish, but structurally they are the same so we use the same Archivist call for example:

    [[!Archivist?
    &target=`[[doclookup? &alias=`press-archives.html`]]`
    &parents=`[[doclookup? &alias=`press/`]]`
    &setLocale=`true`
    ]]


    We use Lexicon entries for standard titles across the different languages and of course regular content and Template Variable fields for different language content.

    We can't figure out how to output the months in the archive in Spanish rather than English. We've set the following context settings on the context itself:

    culturekey = es
    locale = es_ES.UTF-8

    Any suggestions would be greatly welcomed.
      • 39932
      • 483 Posts
      Archivist does not have a Spanish Lexicon. You must create one manually. In fact, Archivist does not use the Lexicon for displaying month names at all. This means you will have to either a) Create a new lexicon and adjust the Archivist Plugin or b) utilize PHP's built in localization (if it has any for Months).

      Having not had to localize Archivist myself, I'm not entirely sure what all of the steps would be. (I use the yyyy/mm/dd format)
        Website: Extended Dialog Development Blog: on Extended Dialog
        Add-ons: AJAX Revolution, RO.IDEs Editor & Framework (in works) Utilities: Plugin Compatibility List
        Tutorials: Create Cross-Context Resources, Cross-Context AJAX Login, Template-Based Actions, Remove Extensions from URLs

        Failure is just another word for saying you didn't want to try. "It can't be done" means "I don't know how".
        • 39932
        • 483 Posts
        After delving into the Archivist code, Archivist uses the PHP localization in order to accomplish localized strings. It does so with the use of the setlocale() PHP function. You must have a System/Context/User Setting named 'locale' (which you do) and it must be set according to the PHP localization guidelines.

        The locale setting must conform to either the ISO 639 standards or RFC 1766 standards.

        As a test, try setting locale to just 'es'
          Website: Extended Dialog Development Blog: on Extended Dialog
          Add-ons: AJAX Revolution, RO.IDEs Editor & Framework (in works) Utilities: Plugin Compatibility List
          Tutorials: Create Cross-Context Resources, Cross-Context AJAX Login, Template-Based Actions, Remove Extensions from URLs

          Failure is just another word for saying you didn't want to try. "It can't be done" means "I don't know how".
        • Thanks. We do realize that it is tied to setlocale() (though I am not a programmer and will consult with our programmer).

          Just es didn't work either.

          Now interestingly, if we go into Locale in System Settings and make the value:

          es_ES.UTF-8

          It does change the language of the months in the Archivist snippet. Unfortunately, it does so across the board (i.e. across the English sites as well) of course, as expected.

          So it appears that the context setting is not being respected.
            • 34027
            • 30 Posts

            After some digging, here's what I have found:

            Archivist gets its locale from the 'locale' property. If that's not set, then it gets it from the system/context/user setting 'cultureKey'.

            The problem is that the default propertyset of Archivist includes a property called 'locale' with a value of 'true'. This may be a bug in Archivist.

            After deleting this property from the Archivist snippet, Archivist properly sets its locale based on 'cultureKey', and everything works correctly.

            Alternatively, the locale can be set directly in the snippet call:
            [[!Archivist?  &locale=`es_ES.UTF-8`]]
            


            This works even if you don't delete the bogus 'locale' property from the Archivist snippet.

            Note that the value must be 'es_ES.UTF-8', not simply 'es'. I don't know if having cultureKey set to 'es_ES.UTF-8' instead of 'es' breaks anything else.

              • 4955
              • 32 Posts
              yeap that's working! thx!
                • 36686
                • 165 Posts
                I'm having the same problem but with Articles.

                Anyone know if/how the above solution could be applied to the [[+archives]] placeholder in an Articles template?

                I'd prefer not having to change code in the snippet, to be able to perform future upgrades without having to fix the issue all over again.
                  • 28120
                  • 380 Posts
                  Did you ever resolve this? I'm about to face this myself.

                  I guess in the template I could replace [[+archives]] with [[!Archivist? &locale=`es_ES.UTF-8`]]