Automatic multilanguage pages (/Security/login, ....)

194 views
Skip to first unread message

Josua

unread,
Mar 15, 2012, 8:03:59 AM3/15/12
to silverst...@googlegroups.com
Hi!

You should put a mechanism whereby we can specify that a page is multilingual by itself, as with the automatic following pages :
    '/Security/login',
    '/Security/lostpassword',
    '/Security/passwordsent',
    '/ForumMemberProfile/register',
    '/ForumMemberProfile/RegistrationForm',
    '/foro/sendacontrols/starttopic'

You should also propagate the locale between them, ie if I call /Security/login from a page with a es_ES locale (ie /inicio (spanish home page)),
/Security/login should be called like this:
/Security/login?locale=es_ES to display the texts in Spanish.
Similarly, if, from the page /Security/login?locale=es_ES is called the page /Security/Lostpassword should automatically use the call with the locale built in the link /Security/lostpassword?locale=es_ES

When we consult these pages if they have other translations should always tell YES.

  public function init() {
        parent::init();

        self::save_current_member();

        if($this->dataRecord->hasExtension('Translatable')) {
            if (!TranslatableExtension::is_page_multilanguage()) {
                TranslatableExtension::set_global_locale($this->dataRecord->Locale);
            }
        }

        // Note: you should use SS template require tags inside your templates
        // instead of putting Requirements calls here.  However these are
        // included so that our older themes still work
        Requirements::themedCSS('layout');
        Requirements::themedCSS('typography');
        Requirements::themedCSS('form');
    }

Also, in the template, the placeholder Translations should give the options available for these sites based on set_allowed_locales, otherwise we have to do strange tricks for these pages.

Translatable::set_allowed_locales(array(
    'en_US',  // US English
    'es_ES'  // Español
));

          <% if Translations %>
              <% control Translations %>
                  <li><a href="$Link" hreflang="$Locale.RFC1766" title="$Title - $Locale.NiceShort">
                  <img src="$ThemeDir/images/flags/lang-<% sprintf(_t('IMAGE','%2.2s'),$Locale.RFC1766) %>.gif"></a>
                  </li>
              <% end_control %>
              <li><a href="$Link" hreflang="$Locale.RFC1766" title="$Title - $Locale.NiceShort">
              <img src="$ThemeDir/images/flags/lang-<% sprintf(_t('IMAGE','%2.2s'),$Locale.RFC1766) %>.gif"></a>
              <span>$Locale.NiceShort</span>
              </li>
          <% else %>
              <% if TranslationsLogin %>
                  <% control TranslationsLogin %>
                      <li><a href="$link" title="$Title - $name">
                      <img src="$ThemeDir/images/flags/lang-<% sprintf(_t('IMAGE','%2.2s'),$localeRFC1766) %>.gif"></a>
                      </li>
                  <% end_control %>
              <% end_if %>
              <li><a href="$PageLink" hreflang="$Locale.RFC1766" title="$Title - $Locale.NiceShort">
              <img src="$ThemeDir/images/flags/lang-<% sprintf(_t('IMAGE','%2.2s'),$Locale.RFC1766) %>.gif"></a>
              <span>$Locale.NiceShort</span>
              </li>
          <% end_if %>


Please, if I have not explained well, consult me.

Sorry for my poor English.

Regards,
Jose

Zauberfisch

unread,
Mar 30, 2012, 1:16:41 AM3/30/12
to silverst...@googlegroups.com
agreed.
but, as far as I remember, Translateable is being moved into a module again (can someone confirm that?), so it probably has not much priority at the moment.
If that is the case, I think it would be best to post this as a issue on the github repo of Translateable or just create a ticket on open.ss.org

Ingo Schommer

unread,
Mar 30, 2012, 3:48:01 AM3/30/12
to silverst...@googlegroups.com
Hello Josua,

Can we please move this to the bug tracker?
I agree that we need a solution for "pseudo-page controller"
localisation like Security/login, keen to discuss further details on a bug ticket.

@Zauberfisch: Translatable has been moved to a module in 3.0,
and yes, it doesn't receive the attention it should. Pull requests welcome :)

All the best
Ingo

> --
> You received this message because you are subscribed to the Google Groups "SilverStripe Core Development" group.
> To view this discussion on the web visit https://groups.google.com/d/msg/silverstripe-dev/-/LkS4Fu_pGp4J.
> To post to this group, send email to silverst...@googlegroups.com (mailto:silverst...@googlegroups.com).
> To unsubscribe from this group, send email to silverstripe-d...@googlegroups.com (mailto:silverstripe-d...@googlegroups.com).
> For more options, visit this group at http://groups.google.com/group/silverstripe-dev?hl=en.

Anselm Christophersen

unread,
Apr 18, 2013, 11:58:42 AM4/18/13
to silverst...@googlegroups.com
Has an issue for this ever been set up?
I'm in a process of needing a translatable "lostpassword" feature, and it doesn't seem to work for me on SS 3.0 to just append a locale, e.g. /Security/lostpassword?locale=es_ES

Any news on this is appreciated

Anselm
> To post to this group, send email to silverst...@googlegroups.com.
> To unsubscribe from this group, send email to silverstripe-d...@googlegroups.com.

Anselm Christophersen

unread,
Apr 18, 2013, 12:34:53 PM4/18/13
to silverst...@googlegroups.com
Seems I can answer my own question - it's here:

My apologies for spamming the dev list.

Tony Air

unread,
Apr 18, 2013, 3:18:49 PM4/18/13
to silverst...@googlegroups.com
Hi we use Security controller extention
---
Name: zz-basicconf
After: framework/routes#coreroutes
---
Director:
  rules:
    'Security//$Action/$ID/$OtherID': 'SecurityExtended'


To unsubscribe from this group and stop receiving emails from it, send an email to silverstripe-d...@googlegroups.com.

To post to this group, send email to silverst...@googlegroups.com.



--
Best regards, Tony Air
CEO, The Web Development Agency (New Castle LLC)

E-mail: to...@thewebdevelopmentagency.ru
Skype: a2nt.fd
Mob. +7 (923) 136-60-13 (OVB)
Mob. +7 (967) 004-08-17 (DME,SVO,VKO)
http://TheWebDevelopmentAgency.ru/
Reply all
Reply to author
Forward
0 new messages