Support Forum

Advanced Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
general-topic
Language files
Avatar
LeoS
Member
Free Members
sp_UserOfflineSmall Offline
Apr 27, 2014 - 3:14 pm

I have language files for Dutch and German in ...sp-resources/forum-language. The default language is Dutch. I inserted the language switcher code in the footer, expecting to see a choice between (default) Dutch and German. To my surprise there is also the option to switch to English (en). Where is that coming from and how do I get rid of it?

Next, the German language option is listed as 'de_DE'. Can I change that somehow into 'Deutsch'?

And BTW, talking about language files, do I yes or no have to rename them from say 'sp-subs-de.mo' to 'sp-subs-de_DE.mo'?

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Apr 27, 2014 - 5:28 pm

the standard wp string for German language is just de and not de_DE... but if the wp translation file you are using is de_DE and that is what you have put in the language string in the wp config file, then yes the filename of our translation files must match...

afraid there is not currently any way to remove the English translation as it comes with the forum since its the forum default language... and no one has ever asked to remove it...  but will add it to the list to see if possible to remove it in the future...

interesting question on the language in the select box...  it just use the translation file name, but certainly understand a friendly display name instead - once again first request!  but not really sure how to do it either...  guess we would have to add some sort of admin UI for changing or provide strings for translation of all possible languages (otherwise the friendly display would be in English)...  or perhaps provide a filter on the displayed names so each user can easily replace just what is being used...  have added it to the list...

Avatar
LeoS
Member
Free Members
sp_UserOfflineSmall Offline
Apr 28, 2014 - 12:17 am

The WP part of the site is solely in Dutch, so WPLANG is set to nl_NL. So I guess it doesn't matter much how the German language files are called as long as the first part is sp-de?

I experimented a little by calling the German language files 'Deutsch', and it worked - but only once.

Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Apr 28, 2014 - 5:23 am

If you feel up to making a small edit to the plugin file I can define a filter now and let you have it and also ensure that it gets into the next release of the plugin...

andy-signature.png
YELLOW
SWORDFISH
Avatar
LeoS
Member
Free Members
sp_UserOfflineSmall Offline
Apr 28, 2014 - 5:36 am

That would be great, please do! It appears rather 'unfinished' now.

Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Apr 28, 2014 - 6:14 am

Well I will guarantee that the filter remains but this might not be the way we choose to handle it longer term. We are actually thinking of maybe giving it a little admin UI to make things easier. But this will work now.

The first file to edit is - by default - 

wp-content/sp-resources/forum-plugins/user-selection/template-tags/sp-user-selection-tags.php

Locate the block of code that looks like this (in the languages section):

foreach ($langs as $lang) {
    $lang = str_replace('sp-', '', trim($lang));
    $selected = (isset($_COOKIE['language']) && $lang == $_COOKIE['language']) ? ' selected="selected" ' : '';
    $out.= '<option'.$selected.' value="'.esc_attr($lang).'">'.esc_html($lang).'</option>';
}

and replace it with the following, Note there is one new line of code and one other has been modified:

foreach ($langs as $lang) {
    $lang = str_replace('sp-', '', trim($lang));
    $display = apply_filters('sph_LanguageDisplay', $lang);
    $selected = (isset($_COOKIE['language']) && $lang == $_COOKIE['language']) ? ' selected="selected" ' : '';
    $out.= '<option'.$selected.' value="'.esc_attr($lang).'">'.esc_html($display).'</option>';
}

Then finally you need to define a filter function in the spFunctions.php file of your Simple:Press theme. This will be in the /templates folder. This should look something like this:

add_filter('sph_LanguageDisplay', 'my_Lang_Names');
function my_Lang_Names($lang) {
    if($lang == 'it') {
        $lang = 'Italian';
    } elseif ($lang == 'fr') {
        $lang = 'French';
    } elseif ($lang == 'de') {
        $lang = 'German';
    return $lang;
}

Of course you will need to supply the language codes that you are actually using and the country names you prefer to use. Define as few or as many as you need but this gives you a coding template to work with.

I am afraid this will not remove the English entry. That will have to come later I am afraid.

andy-signature.png
YELLOW
SWORDFISH
Avatar
LeoS
Member
Free Members
sp_UserOfflineSmall Offline
Apr 28, 2014 - 6:55 am

Thanks! It works. 

I also changed in line 85 the 'Select Language' label to 'Kies taal / Bitte wählen'

Maybe the option to change the label is something to integrate into the admin UI thingy also?

Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Apr 28, 2014 - 7:10 am

LeoS said
Thanks! It works. 

I also changed in line 85 the 'Select Language' label to 'Kies taal / Bitte wählen'

Maybe the option to change the label is something to integrate into the admin UI thingy also?

Well no - those labels are themselves within the plugin's own translation file which is really where they belong.

andy-signature.png
YELLOW
SWORDFISH
Avatar
LeoS
Member
Free Members
sp_UserOfflineSmall Offline
Apr 28, 2014 - 7:37 am

Yellow Swordfish said

LeoS said
Thanks! It works. 

I also changed in line 85 the 'Select Language' label to 'Kies taal / Bitte wählen'

Maybe the option to change the label is something to integrate into the admin UI thingy also?

Well no - those labels are themselves within the plugin's own translation file which is really where they belong.

Ideally yes, but changing it in the language file doesn't seem to do anything.

While we're at it, I'm pulling my hair out trying to find the location of the word avatar on the Profile page. My forum is for older people, they have no idea what an avatar is, so I want it to simply say Image.

Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Apr 28, 2014 - 9:32 am

I can see that the selecter plugin only has about 4 languages where people have added translations and approved them. German is one of them.

The profile tabs and menus are unique in that you can change those main labels in the Profiles Tabs and menus option of the forum admin. In-line form text will reside in the core SP po/mo file.

andy-signature.png
YELLOW
SWORDFISH
Forum Timezone: Europe/Stockholm
Most Users Ever Online: 1170
Currently Online:
Guest(s) 1
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Mr Papa: 19448
Ike: 2086
Brandon: 864
kvr28: 804
jim: 650
FidoSysop: 577
Conrad_Farlow: 531
fiddlerman: 358
Stefano Prete: 325
Member Stats:
Guest Posters: 619
Members: 17361
Moderators: 0
Admins: 4
Forum Stats:
Groups: 7
Forums: 17
Topics: 10127
Posts: 79625