How to install Babel/use Babel properly

Hello,

I’m a bit flummoxed here. I’ve installed Babel according to this video which helped me install everything correct… for the most part. On my site I do not see the ‘create translation’ to the right of the save button, but my page is navigating between contexts correctly. So my first question is, why would I not be seeing the button pictured below?

image

I’m not sure even if that is important, but what I would REALLY like to do is simply have the user click English/Spanish button and when they do so, it changes all the text on the page to the correct language. I remember previously using multiple text fields that showed/hid based on language, but used the same element and didn’t need a duplicate. I can’t find great documentation for babel. What am I overlooking?

I’m only finding code like

[[BabelTranslation? &contextKey=`de`]]

but that makes no sense to me. I can switch de to es but it doesn’t seem to make any difference on the front end. Any help or suggestions on what I’m missing or what a better practice might be? Thank you in advance

1 Like

Hi, have you put the context keys into the Babel system setting?

I believe so

and here is what I have for the context under resources. I followed their htaccess code exactly as it was written. Thank you for your suggestions, let me know if you have any others

Hm, i looked into one of my MODX-installs where I’m using Babel as well…but I don’t have these lot of system-settings like you have:

But what about the “Allow forwarding across contexts”, did you try this with “Yes”-setting?

I guess you have a TV called “babelLanguageLinks” that gets created by installing the Babel-extra?

Good afternoon,

I updated my system settings to allow the Forwarding Across Contexts, and I do have a TV called babelLanguageLinks. I gave it access to the templates I’m using.

I feel like we’re getting there with baby steps, thank you for your suggestions.

Just mentioning… I don’t know exactly what the “Forwarding Across Context”-option is for, because I don’t have this one. I just thought it would be worth a try…

Also in my MODX-manager (which is set to german language), when I open the “babelLanguageLinks”-TV, there is a sentence stated in the descriptions-box meaning something like this:

“This gets managed through the Babel-plugin. Please don’t change”

So I guess you shouldn’t do any changes in here. So I would “reset” your changes and don’t give access to some particular templates, i would uncheck all templates (which basically means that this TV has access to all templates - if i am not wrong).

You do have it, but it’s not in the Babel section. @brittislove’s screenshot was a search for “context”, not filtered on the babel namespace, like yours. :wink:

Forwarding across contexts has to do with symlinks (and custom forwarding, but mostly symlinks). When enabled you can symlink a resource from one context to another.

1 Like

Just posting an update, I’ve been continuing to experiment (giggity) and installed LangRouter which is supposed to work well with Babel and remove all the set up and I’m still experiencing problems.

After playing around on my site some more today, I suspect my .htaccess is set up wrong and thats where the ultimate problem lies. One I know more I will update again, thank you all for giving me ideas to follow up on/suggestions

Maybe you like to post your htaccess-file content and we can see if there is something wrong?

I guess you have seen some other posts in the old forum and maybe this one with some examples of the htaccess-file content to work with Babel?

I just googled and saw this, which seems correct to me (except the wrong commenting-lines):

RewriteEngine On
RewriteBase /

# redirect all requests to /de/favicon.ico and /nl/favicon.ico
# to /favicon.ico
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(web|en)/favicon.ico$ favicon.ico [L,QSA]
   
# redirect all requests to /de/assets* and /nl/assets* to /assets*
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(web|en)/assets(.*)$ assets$2 [L,QSA]
  
# redirect all other requests to /de/* and /nl/*
# to index.php and set the cultureKey parameter
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(web|en)?/?(.*)$ index.php?cultureKey=$1&q=$2 [L,QSA]

You gotta change “en” to “es” for your site…

Friendly-URLs are turned on, right?

Thank you so much for your help, friendly urls are turned on in ModX, but I did leave Strict Friendly URL’s off though

I haven’t had time to touch this website in a while, not looking forward to remembering where I left off two weeks ago

# 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 /
 
RewriteEngine On
RewriteCond %{HTTP_HOST} website\.com [NC]
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://website.com/$1 [R,L]

# The Friendly URLs part
# redirect all requests to /de/favicon.ico and /nl/favicon.ico
# to /favicon.ico
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(en|es)/favicon.ico$ favicon.ico [L,QSA]
                              
# redirect all requests to /de/assets* and /nl/assets* to /assets*
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(en|es)/assets(.*)$ assets$2 [L,QSA]
                             
# redirect all other requests to /de/* and /nl/*
# to index.php and set the cultureKey parameter
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(en|es)?/?(.*)$ index.php?cultureKey=$1&q=$2 [L,QSA]