Quantcast
Channel: phpBB.com
Viewing all articles
Browse latest Browse all 2331

phpBB Discussion • Re: The future of prosilver (phpBB 4)

$
0
0
I was reminded of something. Namely this, in the pbpBB Ideas board: Custom language strings for style creation

Any chance of this being implemented in 4.0? Open source code for this sort of thing already exists. I've used it before. It can be really handy.

ETA: Damn. I just thought of how this could be done in 3.3, in an accessible manner, and without relying on extensions.

All you need is to do is make a simple style_strings.html template, with content like this:

Code:

{% set string1 = 'English string 1' %}{% set string2 = 'English string 2' %}{% set string3 = 'English string 3' %}{% set string4 = 'English string 4' %}{% set string5 = 'English string 5' %}{% set string6 = 'English string 6' %}{% set string7 = 'English string 7' %}
Then you call that in overall_header.html:

Code:

{% EVENT overall_header_stylesheets_after %}{% include 'style_strings.html' %}</head>
Your custom language strings are now template variables, which you can call anywhere:

Code:

<li><a href="{U_SEARCH_SELF}" role="menuitem"><i class="icon fa-file fa-fw" aria-hidden="true"></i><span>{string1}</span></a></li>
You can now use custom language strings in styles, while not breaking Styles DB rules. If anyone wants to use a different language they just do their own translations. The Twig logic can, I'm sure, be fairly easily adjusted to check for the root tag's lang attribute. Something like:

Code:

{% include '{S_USER_LANG}/style_strings.html' %}
...with the style_strings.html templates being stashed in folders for en/ and whatever other languages you want to support. I'm going to mess with this and get it running. :D

Statistics: Posted by Gumboots — Wed Apr 09, 2025 8:50 pm



Viewing all articles
Browse latest Browse all 2331

Trending Articles