General Nav - Different Google fonts only in other language

Hi, I’m using Concrete v. 9.3.6 with Modena Theme. I would like to create the content in a different language and also the main nav should be in a foreign language as well. The question to the community and especially to Michele Locati is: Is it possible to change the main nav fonts only for the 2 language and leave the english version of the website unchanged in terms of fonts? Any help will be appreciated. Thank you, Alex
Url: https://newztravel.com

In Concrete CMS, you can retrieve the current language code in PHP by using the Localization class. Here’s a simple way to get it:

use Concrete\Core\Localization\Localization;

// Get the current language code
$locale = Localization::activeLocale();
$languageCode = \Punic\Language::getAlpha2Code($locale);

echo $languageCode; // Outputs something like "en" for English, "fr" for French, etc.


Localization::activeLocale() returns the current locale (e.g., “en_US”).

\Punic\Language::getAlpha2Code($locale) converts it into a two-letter language code (e.g., “en”).

This code will give you a concise language code based on the active locale, useful if you’re working on a multilingual site in Concrete CMS.

If you echo that out to the body as a class you can then use css to deliver different nav fonts

I am more than happy to help you with this?

Hi Tim, first of all huge thank you for the solution. (Not that I would have the first idea how to do it…) Sorry for not replying earlier. I was busy with my traveling customers. ATM I’m translating each page of the website as AI translation is rather useless in these kind of advertisement texts. I have forwarded your code to a dev who was helping me with the website and I’m waiting for his response.

Glad it helped, i have sent you a message on Skype and happy to do the dev work if you want. I have done a few multilingual sites so can explain a bit further some issues i mange to over come in the past.

1 Like