[ABD] Guest Language Selector

Any abandoned Extensions will be moved to this forum.

WARNING: Extensions in this forum are not currently being supported or maintained by the original Extension author. Proceed at your own risk.
Forum rules
IMPORTANT: Extension Development Forum rules

WARNING: Extensions in this forum are not currently being supported nor updated by the original Extension author. Proceed at your own risk.
MichaT
Registered User
Posts: 15
Joined: Sat Jan 05, 2019 5:44 am
Location: Thailand
Name: Michael

[ABD] Guest Language Selector

Post by MichaT »

Extension Name: Guest Language Selector
Author: MichaT

Extension Description: With this extension, all guests will see a drop-down box with all installed languages ​​in the navigation toolbar.

Extension Version: 1.0.2

Requirements: phpBB 3.3.x

Features:
  • Guests can switch between all installed languages
  • CSS file to change the display style of the drop-down-box
  • INI file to change some options
Screenshot: https://imgur.com/a/yXGf1QB

Extension Download:

Guest Language Selector v1.0.2

Installation:
  1. Download the latest release.
  2. Unzip the downloaded release to `/ext/`.
  3. If done correctly, you'll have the main extension class at (your forum root)/ext/mtsd/switchlang/composer.json
  4. Navigate in the ACP to `Customise -> Manage extensions`
  5. Look for `Guest Language Selector` under the Disabled Extensions list, and click its `Enable` link.
Change log:
## 1.0.2 - 2023-01-12

- phpBB v3.3.x compatibility

## 1.0.1 - 2019-01-09

- added more template variables at "overall_header_breadcrumbs_after.html" for a more flexible layout change
- now the extension automatically ignores the URL parameter "language" if the guest selected a language via the dropdownbox
- now the extension automatically ignores the stored language from the cookie if the URL parameter "language" is used
- removed the no longer required INI option "IgnoreUrlLanguage"

## 1.0.0 - 2019-01-07

- First release
Last edited by MichaT on Sat Jan 14, 2023 6:34 am, edited 2 times in total.
NastyBoy
Registered User
Posts: 137
Joined: Wed May 31, 2017 7:03 pm
Location: Germany
Name: Tim
Contact:

Re: [3.2][BETA] Guest Language Selector

Post by NastyBoy »

That is a good one thank you
NastyBoy
Registered User
Posts: 137
Joined: Wed May 31, 2017 7:03 pm
Location: Germany
Name: Tim
Contact:

Re: [3.2][BETA] Guest Language Selector

Post by NastyBoy »

What exactly does he translate for guests? All forums and texts?
User avatar
pikachuturkey
Registered User
Posts: 337
Joined: Wed Dec 20, 2006 10:34 pm
Location: Türkiye(Turkey)
Name: Rıza

Re: [3.2][BETA] Guest Language Selector

Post by pikachuturkey »

NastyBoy wrote: Wed Jan 23, 2019 5:13 pm What exactly does he translate for guests? All forums and texts?
Guests can switch between all installed languages
Only can switch between installed language. Only Structural texts of phpbb.
NastyBoy
Registered User
Posts: 137
Joined: Wed May 31, 2017 7:03 pm
Location: Germany
Name: Tim
Contact:

Re: [3.2][BETA] Guest Language Selector

Post by NastyBoy »

okay thank you
sanekplus
Registered User
Posts: 6
Joined: Thu May 14, 2020 12:17 pm

Re: [3.2][BETA] Guest Language Selector

Post by sanekplus »

Some fixes for phpBB 3.3 compatibility.

1) New ext/mtsd/langswitch/config/services.yml

Code: Select all

services:
    mtsd.langswitch.listener:
        class: 'mtsd\langswitch\event\listener'
        arguments:
            - '@config'
            - '@template'
            - '@user'
            - '@dbal.conn'
        tags:
            - { name: 'event.listener' }
2) Fix broken path to globe.png for non-root sections like FAQ

Code: Select all

--- ext/mtsd/langswitch/event/listener.php	2020-05-14 14:58:01.480283144 +0300
+++ ext/mtsd/langswitch/event/listener.php	2020-05-14 15:01:15.361017659 +0300
@@ -80,7 +80,8 @@
 	    $this->template->assign_vars(array('LANG_LIST_START' => $template_var));
 	    
 	    //$lang_form .= '<label for="language_selector">'.$user->lang['L_LANGUAGE'].$user->lang['L_COLON'].'</label>';
-			$template_var = '<span class="langswitch_globe"><img src="./ext/mtsd/langswitch/styles/all/theme/images/globe.png"></span>';
+			global $phpbb_path_helper;
+			$template_var = '<span class="langswitch_globe"><img src="'.$phpbb_path_helper->get_web_root_path().'/ext/mtsd/langswitch/styles/all/theme/images/globe.png"></span>';
 			$this->template->assign_vars(array('LANG_GLOBE_ICON' => $template_var));
 			
 			$template_var = '<form class="langswitch_form" method="post">';
3) Remove original language selector on registration page broken by extension (actually it is not extension but prosilver patch)

Code: Select all

--- styles/prosilver/template/ucp_agreement.html	2020-05-14 15:49:17.168977907 +0300
+++ styles/prosilver/template/ucp_agreement.html	2020-05-14 16:01:24.324791843 +0300
@@ -15,12 +15,6 @@
 	}
 </script>
 
-	<form method="post" action="{S_UCP_ACTION}" id="register">
-		<p class="rightside">
-			<label for="lang">{L_LANGUAGE}{L_COLON}</label><select name="lang" id="lang" onchange="change_language(this.value); return false;" title="{L_LANGUAGE}">{S_LANG_OPTIONS}</select>
-			{S_HIDDEN_FIELDS}
-		</p>
-	</form>
 
 	<div class="clear"></div>
 
php_BB_Lover
I've Been Banned!
Posts: 352
Joined: Tue Jun 23, 2020 5:18 am

Re: [3.2][BETA] Guest Language Selector

Post by php_BB_Lover »

sanekplus wrote: Thu May 14, 2020 1:14 pm Some fixes for phpBB 3.3 compatibility.

1) New ext/mtsd/langswitch/config/services.yml

Code: Select all

services:
    mtsd.langswitch.listener:
        class: 'mtsd\langswitch\event\listener'
        arguments:
            - '@config'
            - '@template'
            - '@user'
            - '@dbal.conn'
        tags:
            - { name: 'event.listener' }
2) Fix broken path to globe.png for non-root sections like FAQ

Code: Select all

--- ext/mtsd/langswitch/event/listener.php	2020-05-14 14:58:01.480283144 +0300
+++ ext/mtsd/langswitch/event/listener.php	2020-05-14 15:01:15.361017659 +0300
@@ -80,7 +80,8 @@
 	    $this->template->assign_vars(array('LANG_LIST_START' => $template_var));
 	    
 	    //$lang_form .= '<label for="language_selector">'.$user->lang['L_LANGUAGE'].$user->lang['L_COLON'].'</label>';
-			$template_var = '<span class="langswitch_globe"><img src="./ext/mtsd/langswitch/styles/all/theme/images/globe.png"></span>';
+			global $phpbb_path_helper;
+			$template_var = '<span class="langswitch_globe"><img src="'.$phpbb_path_helper->get_web_root_path().'/ext/mtsd/langswitch/styles/all/theme/images/globe.png"></span>';
 			$this->template->assign_vars(array('LANG_GLOBE_ICON' => $template_var));
 			
 			$template_var = '<form class="langswitch_form" method="post">';
3) Remove original language selector on registration page broken by extension (actually it is not extension but prosilver patch)

Code: Select all

--- styles/prosilver/template/ucp_agreement.html	2020-05-14 15:49:17.168977907 +0300
+++ styles/prosilver/template/ucp_agreement.html	2020-05-14 16:01:24.324791843 +0300
@@ -15,12 +15,6 @@
 	}
 </script>
 
-	<form method="post" action="{S_UCP_ACTION}" id="register">
-		<p class="rightside">
-			<label for="lang">{L_LANGUAGE}{L_COLON}</label><select name="lang" id="lang" onchange="change_language(this.value); return false;" title="{L_LANGUAGE}">{S_LANG_OPTIONS}</select>
-			{S_HIDDEN_FIELDS}
-		</p>
-	</form>
 
 	<div class="clear"></div>
 
Hi,
there is also language-select in ucp_register.html that dosnt work.
when i select a language, it redirects to register page again,
how can i fix this too? to store the selected-language in user-profile?
thank you,

styles\prosilver\template\ucp_register.html

Code: Select all

<dl>
	<dt><label for="lang">{L_LANGUAGE}{L_COLON}</label></dt>
	<dd><select name="lang" id="lang" onchange="change_language(this.value); return false;" tabindex="6" title="{L_LANGUAGE}">{S_LANG_OPTIONS}</select></dd>
</dl>
sanekplus
Registered User
Posts: 6
Joined: Thu May 14, 2020 12:17 pm

Re: [3.2][BETA] Guest Language Selector

Post by sanekplus »

php_BB_Lover wrote: Tue Jun 23, 2020 5:52 am there is also language-select in ucp_register.html that dosnt work.
when i select a language, it redirects to register page again,
how can i fix this too? to store the selected-language in user-profile?
Yes, you are right
4) Prevent second original lang selector in registration form to restart registration process (also prosilver not ext patch), maybe it is better to remove second selector completely

Code: Select all

--- styles/prosilver/template/ucp_register.html	2020-06-23 14:10:28.297188370 +0300
+++ styles/prosilver/template/ucp_register.html	2020-06-23 14:18:23.897738018 +0300
@@ -59,7 +59,7 @@
 	<!-- EVENT ucp_register_options_before -->
 	<dl>
 		<dt><label for="lang">{L_LANGUAGE}{L_COLON}</label></dt>
-		<dd><select name="lang" id="lang" onchange="change_language(this.value); return false;" tabindex="6" title="{L_LANGUAGE}">{S_LANG_OPTIONS}</select></dd>
+		<dd><select name="lang" id="lang" onchange="document.cookie = '{COOKIE_NAME}_lang=' + this.value + '; path={COOKIE_PATH}'; return false;" tabindex="6" title="{L_LANGUAGE}">{S_LANG_OPTIONS}</select></dd>
 	</dl>
 
 	<!-- INCLUDE timezone_option.html -->
php_BB_Lover
I've Been Banned!
Posts: 352
Joined: Tue Jun 23, 2020 5:18 am

Re: [3.2][BETA] Guest Language Selector

Post by php_BB_Lover »

sanekplus wrote: Tue Jun 23, 2020 11:52 am
php_BB_Lover wrote: Tue Jun 23, 2020 5:52 am there is also language-select in ucp_register.html that dosnt work.
when i select a language, it redirects to register page again,
how can i fix this too? to store the selected-language in user-profile?
Yes, you are right
4) Prevent second original lang selector in registration form to restart registration process (also prosilver not ext patch), maybe it is better to remove second selector completely

Code: Select all

--- styles/prosilver/template/ucp_register.html	2020-06-23 14:10:28.297188370 +0300
+++ styles/prosilver/template/ucp_register.html	2020-06-23 14:18:23.897738018 +0300
@@ -59,7 +59,7 @@
 	<!-- EVENT ucp_register_options_before -->
 	<dl>
 		<dt><label for="lang">{L_LANGUAGE}{L_COLON}</label></dt>
-		<dd><select name="lang" id="lang" onchange="change_language(this.value); return false;" tabindex="6" title="{L_LANGUAGE}">{S_LANG_OPTIONS}</select></dd>
+		<dd><select name="lang" id="lang" onchange="document.cookie = '{COOKIE_NAME}_lang=' + this.value + '; path={COOKIE_PATH}'; return false;" tabindex="6" title="{L_LANGUAGE}">{S_LANG_OPTIONS}</select></dd>
 	</dl>
 
 	<!-- INCLUDE timezone_option.html -->
thank you, worked!
two questions for you:
1. what code should i edit, to show the language-select in the same place, after user-login too? (when users change the language from here, it changes their profile language too, or vice versa)
2. is it possible to fix this extension, not to edit theme files? (ucp_agreement.html, ucp_register.html)
Version: phpBB 3.3.0
Theme: default
Regards
sanekplus
Registered User
Posts: 6
Joined: Thu May 14, 2020 12:17 pm

Re: [3.2][BETA] Guest Language Selector

Post by sanekplus »

php_BB_Lover wrote: Wed Jun 24, 2020 3:43 am two questions for you:
1. what code should i edit, to show the language-select in the same place, after user-login too? (when users change the language from here, it changes their profile language too, or vice versa)
2. is it possible to fix this extension, not to edit theme files? (ucp_agreement.html, ucp_register.html)
Sorry, I don't know, I'm not professional phpBB developer, I just adopt this extension to my goals in the simplest way: before login user can change language using extension, after login user can change language using profile setting.
php_BB_Lover
I've Been Banned!
Posts: 352
Joined: Tue Jun 23, 2020 5:18 am

Re: [3.2][BETA] Guest Language Selector

Post by php_BB_Lover »

sanekplus wrote: Wed Jun 24, 2020 11:36 am
php_BB_Lover wrote: Wed Jun 24, 2020 3:43 am two questions for you:
1. what code should i edit, to show the language-select in the same place, after user-login too? (when users change the language from here, it changes their profile language too, or vice versa)
2. is it possible to fix this extension, not to edit theme files? (ucp_agreement.html, ucp_register.html)
Sorry, I don't know, I'm not professional phpBB developer, I just adopt this extension to my goals in the simplest way: before login user can change language using extension, after login user can change language using profile setting.
Thank you, I was just thinking about to change the language by both (extension and profile setting) after login. But i don't know how to show the language-select to logged-in users!
Version: phpBB 3.3.0
Theme: default
Regards
Raptiye
Registered User
Posts: 28
Joined: Sun Jan 17, 2021 8:52 pm

Re: [3.2][BETA] Guest Language Selector

Post by Raptiye »

How to show for registered users? Ty.
"No, because then you would copy it and I don't want that. I'm sure you understand that."
Even your profile picture is a duplicate. AmigoJack :lol:
Thunde
Registered User
Posts: 263
Joined: Fri Aug 28, 2020 2:30 pm

Re: [3.2][BETA] Guest Language Selector

Post by Thunde »

Link invalid
User avatar
ssl
Registered User
Posts: 1654
Joined: Sat Feb 08, 2020 2:15 pm
Location: Le Lude, Pays de la Loire - France
Name: Fred Rimbert
Contact:

Re: [3.2][BETA] Guest Language Selector

Post by ssl »

Are you sure?

Capture d’écran 2021-03-07 à 11.01.08.png
Capture d’écran 2021-03-07 à 11.01.08.png (19.36 KiB) Viewed 4366 times
Sorry for my English ... I do my best!

phpBB: 3.3.11 | PHP: 8.2.16
[Kill spam on phpBB] - [Some French translation of extensions]
"Mistress, Mistress someone is bothering me in pm"
Thunde
Registered User
Posts: 263
Joined: Fri Aug 28, 2020 2:30 pm

Re: [3.2][BETA] Guest Language Selector

Post by Thunde »

Error :

Code: Select all

/home/games4al/public_html/ext/mtsd/langswitch/config/services.yml" does not contain valid YAML: The reserved indicator "@" cannot start a plain scalar; you need to quote the scalar at line 5 (near "- @config").

#0 /home/games4al/public_html/vendor/symfony/dependency-injection/Loader/YamlFileLoader.php(117): Symfony\Component\DependencyInjection\Loader\YamlFileLoader->loadFile('/home/games4al/...')
#1 /home/games4al/public_html/phpbb/extension/di/extension_base.php(99): Symfony\Component\DependencyInjection\Loader\YamlFileLoader->load('services.yml')
#2 /home/games4al/public_html/phpbb/extension/di/extension_base.php(63): phpbb\extension\di\extension_base->load_services(Object(Symfony\Component\DependencyInjection\Compiler\MergeExtensionConfigurationContainerBuilder))
#3 /home/games4al/public_html/vendor/symfony/dependency-injection/Compiler/MergeExtensionConfigurationPass.php(71): phpbb\extension\di\extension_base->load(Array, Object(Symfony\Component\DependencyInjection\Compiler\MergeExtensionConfigurationContainerBuilder))
#4 /home/games4al/public_html/vendor/symfony/http-kernel/DependencyInjection/MergeExtensionConfigurationPass.php(39): Symfony\Component\DependencyInjection\Compiler\MergeExtensionConfigurationPass->process(Object(Symfony\Component\DependencyInjection\ContainerBuilder))
#5 /home/games4al/public_html/vendor/symfony/dependency-injection/Compiler/Compiler.php(140): Symfony\Component\HttpKernel\DependencyInjection\MergeExtensionConfigurationPass->process(Object(Symfony\Component\DependencyInjection\ContainerBuilder))
#6 /home/games4al/public_html/vendor/symfony/dependency-injection/ContainerBuilder.php(789): Symfony\Component\DependencyInjection\Compiler\Compiler->compile(Object(Symfony\Component\DependencyInjection\ContainerBuilder))
#7 /home/games4al/public_html/phpbb/di/container_builder.php(212): Symfony\Component\DependencyInjection\ContainerBuilder->compile()
#8 /home/games4al/public_html/common.php(115): phpbb\di\container_builder->get_container()
#9 /home/games4al/public_html/adm/index.php(23): require('/home/games4al/...')
#10 {main}
Locked

Return to “Abandoned Extensions”