Support Forum
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'?
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...
Visit Cruise Talk Central and Mr Papa's World
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.
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.
YELLOW
SWORDFISH
|
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.
YELLOW
SWORDFISH
|
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.
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.
YELLOW
SWORDFISH
|
1 Guest(s)