We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 37123
    • 186 Posts
    Ciao a tutti, sono quasi giunto alla fine del mio progetto, ho un ultmo dubbio sull'uso di babel
    http://designfromwithin.com/blog/995/modx-multilingual-setting-up-babel/
    Ho seguito tutte le istruzioni, alcune cose funzionano, altre no e vorrei capire il motivo perche è un plug in interessante...

    Cerco di spiegarvi il problema: ho due contesti, uno per la lingua italiana e uno per la lingua inglese.
    Per la lingua italiana uso quello di default (Web) mentre per l'inglese ho aggiunto il contesto English come potete vedere dall'albero.

    Se creo una risorsa dentro web funziona tutto a dovere, sia i link per cambiare la lingua sia i template che il content. Se creo una risorsa dentro a english NON viene preso un bel niente, ne il template (che resta quello di default) ne il content che resta quello della home... non riesco a capire il perche.
    I link però sono giusti e puntano alle risorse giuste
    <ul>
      <li><a href="http://127.0.0.1/xampp/modxr/" class="it active">Italian</a></li><li><a href="http://127.0.0.1/xampp/modxr/en/" class="en">English</a></li>
    </ul>
    SITO ITALIANO
    

    Sopra il codice per la risorsa numero 1, ma è uguale alla risorsa numero 7, peccato che il content delle due risorse (cosi come l'alias e il title) è diverso, dentro la risorsa 7 ho scritto SITO INGLESE...
    Non mi spiego nemmeno perche mi prende gli alias solo delle risorse dentro Web.
    Gli accessi ai contesti sono uguali sia per web che per english...

    Idee? Suggerimenti? Io penso che l'htaccess sia settato correttamente...
    • ci sto sbattendo la testa anche io in questi giorni,
      potresti postare il contenuto del file htaccess?
        TilliLab | MODX Ambassador
        website
        • 37123
        • 186 Posts
        Questo è il mio file htaccess, come consigliano nel tutorial.

        # MODX supports Friendly URLs via this .htaccess file. You must serve web
        # pages via Apache with mod_rewrite to use this functionality, and you must
        # change the file name from ht.access to .htaccess.
        #
        # Make sure RewriteBase points to the directory where you installed MODX.
        # E.g., "/modx" if your installation is in a "modx" subdirectory.
        #
        # You may choose to make your URLs non-case-sensitive by adding a NC directive
        # to your rule: RewriteRule ^(.*)$ index.php?q=$1 [L,QSA,NC]
        
        RewriteEngine On
        RewriteBase /xampp/modxr/
        
        
        
        # Rewrite www.domain.com -> domain.com -- used with SEO Strict URLs plugin
        #RewriteCond %{HTTP_HOST} .
        #RewriteCond %{HTTP_HOST} !^127\.0\.0\.1/xampp/modxr [NC]
        #RewriteRule (.*) http://127.0.0.1/xampp/modxr$1 [R=301,L]
        #
        # or for the opposite domain.com -> www.domain.com use the following
        # DO NOT USE BOTH
        #
        #RewriteCond %{HTTP_HOST} .
        #RewriteCond %{HTTP_HOST} !^127\.0\.0\.1/xampp/modxr [NC]
        #RewriteRule (.*) http://127.0.0.1/xampp/modxr$1 [R=301,L]
        
        
        
        # Rewrite secure requests properly to prevent SSL cert warnings, e.g. prevent 
        # https://www.domain.com when your cert only allows https://secure.domain.com
        #RewriteCond %{SERVER_PORT} !^443
        #RewriteRule (.*) https://127.0.0.1/xampp/modxr$1 [R=301,L]
        
        
        
        # The Friendly URLs part
        # detect language when requesting the root (/)
        RewriteCond %{HTTP:Accept-Language} !^ [NC]
        RewriteRule ^$ / [R=301,L]
        
        # redirect all requests to /en/favicon.ico
        # to /favicon.ico
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteRule ^(en)/favicon.ico$ favicon.ico [L,QSA]
         
        # redirect all requests to /en/assets* to /assets*
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteRule ^(en)/assets(.*)$ assets$2 [L,QSA]
         
        # redirect all other requests to /en/*
        # to index.php and set the cultureKey parameter
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteRule ^(en)?/?(.*)$ index.php?cultureKey=$1&q=$2 [L,QSA]
            
        
        # Make sure .htc files are served with the proper MIME type, which is critical
        # for XP SP2. Un-comment if your host allows htaccess MIME type overrides.
        
        #AddType text/x-component .htc
        
        
        
        # If your server is not already configured as such, the following directive
        # should be uncommented in order to set PHP's register_globals option to OFF.
        # This closes a major security hole that is abused by most XSS (cross-site
        # scripting) attacks. For more information: http://php.net/register_globals
        #
        # To verify that this option has been set to OFF, open the Manager and choose
        # Reports -> System Info and then click the phpinfo() link. Do a Find on Page
        # for "register_globals". The Local Value should be OFF. If the Master Value
        # is OFF then you do not need this directive here.
        #
        # IF REGISTER_GLOBALS DIRECTIVE CAUSES 500 INTERNAL SERVER ERRORS :
        #
        # Your server does not allow PHP directives to be set via .htaccess. In that
        # case you must make this change in your php.ini file instead. If you are
        # using a commercial web host, contact the administrators for assistance in
        # doing this. Not all servers allow local php.ini files, and they should
        # include all PHP configurations (not just this one), or you will effectively
        # reset everything to PHP defaults. Consult www.php.net for more detailed
        # information about setting PHP directives.
        
        #php_flag register_globals Off
        
        
        
        # For servers that support output compression, you should pick up a bit of
        # speed by un-commenting the following lines.
        
        #php_flag zlib.output_compression On
        #php_value zlib.output_compression_level 5
        
        
        
        # The following directives stop screen flicker in IE on CSS rollovers. If
        # needed, un-comment the following rules. When they're in place, you may have
        # to do a force-refresh in order to see changes in your designs.
        
        #ExpiresActive On
        #ExpiresByType image/gif A2592000
        #ExpiresByType image/jpeg A2592000
        #ExpiresByType image/png A2592000
        #BrowserMatch "MSIE" brokenvary=1
        #BrowserMatch "Mozilla/4.[0-9]{2}" brokenvary=1
        #BrowserMatch "Opera" !brokenvary
        #SetEnvIf brokenvary 1 force-no-vary
        • Ciao, ti scrivo il mio, riducendolo solo alla parte relativa a Babel, ci sono alcune differenze, a parte che uso 3 lingue.

          Per la mia procedura ho seguito questo tutorial, non so se è diverso dal tuo nei contenuti:

          http://www.multilingual-modx.com/blog/2011/seo-friendly-multilingual-websites-with-modx-and-babel.html

          codice htaccess:

          # detect language when requesting the root (/)
          RewriteCond %{HTTP:Accept-Language} !^(it|en|fr) [NC]
          RewriteRule ^$ fr/ [R=301,L]
          RewriteRule ^$ en/ [R=301,L]
          RewriteRule ^$ it/ [R=301,L]
          
          RewriteCond %{REQUEST_FILENAME} !-d
          RewriteCond %{REQUEST_FILENAME} !-f
          RewriteRule ^(fr|en|it)/favicon.ico$ favicon.ico [L,QSA]
          
          RewriteCond %{REQUEST_FILENAME} !-d
          RewriteCond %{REQUEST_FILENAME} !-f
          RewriteRule ^(fr|it|en)/assets(.*)$ assets$2 [L,QSA]
          
          RewriteCond %{REQUEST_FILENAME} !-d
          RewriteCond %{REQUEST_FILENAME} !-f
          RewriteRule ^(fr|it|en)/media(.*)$ media$2 [L,QSA]
          
          RewriteCond %{REQUEST_FILENAME} !-d
          RewriteCond %{REQUEST_FILENAME} !-f
          RewriteRule ^(fr|it|en)/template(.*)$ template$2 [L,QSA]
          
            TilliLab | MODX Ambassador
            website
            • 37123
            • 186 Posts
            io ho seguito questo, c'e anche un video sul tubo
            http://designfromwithin.com/blog/995/modx-multilingual-setting-up-babel/
            Io è possibile che mi confondo editando l'htaccess per passare da 3 lingue a 2 (la default è ita e in piu c'è en/) Ad esempio, editando il tuo codice

            RewriteCond %{HTTP:Accept-Language} !^(it|en) [NC]
            RewriteRule ^$ it/ [R=301,L]
            RewriteRule ^$ en/ [R=301,L]
            


            Ma questo significa che anche la versione di default del sito compare in un indirizzo simile a questo
            http://www.miosito.com/it/index.php
            mentre per la root vorrei fosse semplicemente
            http://www.miosito.com/index.php
            (sto semplificando togliendo la riscrittura degli URL per ora)
            Così ho modificato ancora il codice e sono arrivato a

            RewriteCond %{HTTP:Accept-Language} !^ [NC]
            RewriteRule ^$ / [R=301,L]


            Ma non essendo eperto del file htaccess è plausibile che non voglia dire niente...

            Tu che problemi trovi in questo plugin?
            • Come dici giustamente te se scelgo italiano si apre:

              http://www.miosito.com/it/index.php

              io ho problemi perchè non c'è verso di assegnare la lingua di default...parte sempre con il francese...se lo elimino parte con l'inglese, insomma l'italiano non gli piace proprio! smiley
                TilliLab | MODX Ambassador
                website
                • 37123
                • 186 Posts
                il contesto default come lo hai impostato? Nel tuo caso credo che base url debba essere settato con /it/ e culture key con it.

                Ma a parte quel problema il content ti cambia in base alla lingua almeno? Io non riesco proprio a risolvere, vabbè che non ho fretta però mi sta facendo arrabbiare!

                - Base URL
                Key: base_url
                Name: Base URL
                Area Lexicon Entry: language
                Value: /
                - Culture key
                Key: cultureKey
                Name: Culture key
                Area Lexicon Entry: language
                Value: en
                - Site start
                Key: site_start
                Name: Site start
                Area Lexicon Entry: language
                Value: 1
                - Site URL
                Key: site_url
                Name: Site URL
                Area Lexicon Entry: language
                Value: http://modxtutorials.com/ (change 'modxtutorials.com' to your website url)
                • Il resto funziona correttamente, è solo la gestione del percorso root che mi fa impazzire...ho modificato varie volte il file htaccess, ma credo che il nodo sia nel plugin che funziona come getaway, sembra ignorare l'opzione di default...

                  Questi sono i settaggi dei miei contesti:

                  Contesto "web"

                  cultureKey: it
                  base_url: /it/
                  error_page: 1
                  site_start: 1
                  site_url: http://www.mio-sito.it/folder-sito/it/


                  Contesto "en"

                  cultureKey: en
                  base_url: /en/
                  error_page: 3
                  site_start: 3
                  site_url: http://www.mio-sito.it/folder-sito/en/

                  Contesto "fr"

                  cultureKey: fr
                  base_url: /fr/
                  error_page: 8
                  site_start: 8
                  site_url: http://www.mio-sito.it/folder-sito/fr/

                  PLUGIN GETAWAY:

                  <?php
                  if($modx->context->get('key') != "mgr"){
                      /* grab the current langauge from the cultureKey request var */
                      switch ($_REQUEST['cultureKey']) {
                          case 'en':
                              /* switch the context */
                              $modx->switchContext('en');   
                              break;
                          case 'fr':
                              /* switch the context */
                              $modx->switchContext('fr');
                              break;
                    
                          default:
                              /* Set the default context here */
                              $modx->switchContext('web');
                              break;
                      }
                      /* unset GET var to avoid
                       * appending cultureKey=xy to URLs by other components */
                      unset($_GET['cultureKey']);
                  }
                  


                  con l'evento associato: OnHandleRequest
                    TilliLab | MODX Ambassador
                    website
                    • 37123
                    • 186 Posts
                    In effetti sembra tutto in ordine, io non ho la gestione degli errori ma è un dettaglio. Anche sul plugin è difficile sbagliare.
                    Sul tutorial che ti ho postato però nella configurazione di default si visualizza senza la sottocartella della lingua www.miosito.com/index.php
                    Non vorrei che il plugin, come dicevi tu, funzioni solo in questo modo e che sia da mettere mano al core del plugin stesso...
                      • 20215
                      • 144 Posts
                      Scusate se riapro questa vecchia discussione.
                      Volevo sapere in caso di multilingua e multidominio, esempio sito 3 lingue it|en|fr avendo 3 domini dominio.it dominio.com dominio.fr, come vi comportate?

                      ogni dominio.ext/subfolderLAng ?
                      dal punto di vista SEO quale sarebbe al soluzione migliore?

                      Ciao
                        ----------------------------------
                        canale irc Italiano #modx server: tophost.azzurra.org