Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

Welcome to the CollectiveAccess support forum! Here the developers and community answer questions related to use of the software. Please include the following information in every new issue posted here:

  1. Version of the software that is used, along with browser and version

  2. If the issue pertains to Providence, Pawtucket or both

  3. What steps you’ve taken to try to resolve the issue

  4. Screenshots demonstrating the issue

  5. The relevant sections of your installation profile or configuration including the codes and settings defined for your local elements.


If your question pertains to data import or export, please also include:

  1. Data sample

  2. Your mapping


Answers may be delayed for posts that do not include sufficient information.

Locale switching in Pawtucket2

Hi, I need advice about locale switching in Pawtucket2
Currently I'm using following code (partially taken from Pawtucket1):
<?php
# Locale selection
global $g_ui_locale;
$url = explode('/lang', $this->request->getRequestUrl());
if (is_array($va_ui_locales = $this->request->config->getList('ui_locales')) && (sizeof($va_ui_locales) > 1)) {
print caFormTag($this->request, $this->request->getAction(), 'caLocaleSelectorForm', null, 'get', 'multipart/form-data', '_top', array('disableUnsavedChangesWarning' => true));
$va_locale_options = array();
foreach($va_ui_locales as $vs_locale) {
$va_parts = explode('_', $vs_locale);
$vs_lang_name = Zend_Locale::getTranslation(strtolower($va_parts[0]), 'language', strtolower($va_parts[0]));
$va_locale_options[$vs_lang_name] = $vs_locale;
}
print caHTMLSelect('lang', $va_locale_options, array('id' => 'caLocaleSelectorSelect', 'onchange' => 'window.location = \'/'.$url[0].'?lang=\' + jQuery(\'#caLocaleSelectorSelect\').val();'), array('value' => $g_ui_locale, 'dontConvertAttributeQuotesToEntities' => true));
print "</form>\n";
}
?>
The code is working as far as I can test it, but I need an expert comment is this correct implementation or not.


Comments

  • I think you might be the first one to do a multilingual setup with Pawtucket2.

    This looks okay -- the only problem I see with this is that it assumes /lang/foo_BAR is at the end of the URL because you just chop it off. That should work in most cases I suppose but I'm not sure if it covers everything. 
  • I'm trying to implement this feature.
    Just I am having a strange behaviour: I have defined three languages (it_IT, en_US and fr_FR), creating the corrispondent views for each language (ca_objects_default_html.php.it_IT, ca_objects_default_html.php.fr_FR).
    Now, starting with /app/tmp clean it works fine; but when changing language, without cleaning the cache, any code block like
     {{{<ifdef code="ca_objects.idno"><H6>Identifier:</H6> <span class="trimText">^ca_objects.idno</span></ifdef>}}}
    get rendered "as-is", and not correctly interpreted.

    Any suggestion?
  • edited May 23

    .

Sign In or Register to comment.