Skip to content

How to create a page with content in multiple languages

Bugo edited this page Nov 13, 2024 · 3 revisions
  • Activate "Enable user-selectable language support" option in your SMF settings (Configuration => Languages => Settings)

Option 1

  • Create a portal page of PHP type
  • Enter titles in multiple languages
  • Enter a content like this:
<?php

use Bugo\Compat\User;

if (User::$info['language'] === 'french') {
   echo 'French translation';
} elseif (User::$info['language'] === 'spanish') {
   echo 'Spanish translation';
} else {
   echo 'Your original text';
}

?>

Option 2

  • Install Show Specified Language modification
  • Create a portal page of BBCode type
  • Enter titles in multiple languages
  • Enter a content like this:
[language=english]Hi all![/language]
[language=spanish]Hola, esta es una prueba[/language]