Advanced search  

News:

cpg1.5.46 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter recently discovered vulnerabilities. It is important that all users who run version cpg1.5.44 or older update to this latest version as soon as possible.
[more]

Pages: [1]   Go Down

Author Topic: Switching languages in theme's template.html file  (Read 1019 times)

0 Members and 1 Guest are viewing this topic.

café

  • Coppermine newbie
  • Country: br
  • Offline Offline
  • Posts: 7
Switching languages in theme's template.html file
« on: June 09, 2018, 02:43:19 pm »

Hi Forum,

I'm creating a bilingual gallery with CPG. I'm using a theme which displays a number of custom phrases in English that are defined in the template.html file for the theme rather than from the strings defined in lang/english.php. I thought I could switch between English and Portuguese using PHP to detect the browser language settings but this doesn't work in the template.html file (i think it would need to be a *.php file).

Can anyone please offer a suggestion? I'm testing the page here: http://escuta.org/fotos - see the english titles "Gallery Options" and "User Options", for example.

Sorry, I'm not much good at php...

Thanks,

Logged

ron4mac

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Posts: 1015
Re: Switching languages in theme's template.html file
« Reply #1 on: June 10, 2018, 02:24:09 am »

That is not currently a capability for a theme. But I think it is a useful capability to add and I will put it on the new features list.
Logged

ron4mac

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Posts: 1015
Re: Switching languages in theme's template.html file
« Reply #2 on: June 12, 2018, 01:03:29 pm »

Had some time to work out theme language additions.

Replace include/functions.inc.php with the attached.

Create a lang folder in your theme with language files as the following:

english.php
Code: [Select]
<?php

$theme_lang
['GALLERY_OPTIONS'] = 'Gallery Options';
$theme_lang['USER_OPTIONS'] = 'User Options';

Then, in your theme template, use {THEME_LANG_GALLERY_OPTIONS}, etc.
« Last Edit: June 12, 2018, 01:49:03 pm by ron4mac »
Logged
Pages: [1]   Go Up
 

Page created in 0.019 seconds with 20 queries.