Use [] and array() consistently

Having a question about translating phpBB 3.3? Want to discuss and collaborate with people currently translating phpBB 3.3? Here would be the correct place to do so.
User avatar
scootergrisen
Translator
Posts: 257
Joined: Thu Aug 25, 2011 2:25 pm

Use [] and array() consistently

Post by scootergrisen »

I notice in 3.3.13 that two files (language\en\acp\styles.php and language\en\captcha_recaptcha.php) contain:

Code: Select all

$lang = array_merge($lang, [
	[...]
]);
Where the other files seem to use:

Code: Select all

$lang = array_merge($lang, array(
	[...]
));
I guess it does the same but maybe they should use the same style to be consistent across all files.
User avatar
Anișor
Translator
Posts: 330
Joined: Tue Jan 08, 2013 9:36 pm
Location: Arbroath, Angus, Scotland

Re: Use [] and array() consistently

Post by Anișor »

They both do the same.
You can use either array() or simply [] to define an array.
But yes, same for some <br /> which were replaced with <br> in some of the files only.
User avatar
scootergrisen
Translator
Posts: 257
Joined: Thu Aug 25, 2011 2:25 pm

Re: Use [] and array() consistently

Post by scootergrisen »

"<br />" could be changed to "<br>" too for consistency.
Even though it occur 423 it would be easy for the translators to change if they know how to do search and replace.
User avatar
Gumboots
Registered User
Posts: 800
Joined: Fri Oct 11, 2019 1:59 am

Re: Use [] and array() consistently

Post by Gumboots »

<br /> is XHTML. phpBB uses an HTML5 doctype, so all of those tags should be <br>. Find/replace will do the lot in a one second. I do it anyway if I am editing any file.
🇺🇦 Слава Україні! 🇺🇦 Героям слава! 🇺🇦
User avatar
scootergrisen
Translator
Posts: 257
Joined: Thu Aug 25, 2011 2:25 pm

Re: Use [] and array() consistently

Post by scootergrisen »

Both <br> and <br /> are valid.
User avatar
scootergrisen
Translator
Posts: 257
Joined: Thu Aug 25, 2011 2:25 pm

Re: Use [] and array() consistently

Post by scootergrisen »

One more [] in language\en\cli.php:

Code: Select all

	'CLI_USER_RECLEAN_DONE'			=> [
		0	=> 'Re-cleaning complete. No usernames needed to be cleaned.',
		1	=> 'Re-cleaning complete. %d username was cleaned.',
		2	=> 'Re-cleaning complete. %d usernames were cleaned.',
	],
User avatar
Toxyy
Registered User
Posts: 963
Joined: Mon Oct 24, 2016 3:22 pm
Location: Namek

Re: Use [] and array() consistently

Post by Toxyy »

scootergrisen wrote: Wed Sep 11, 2024 11:01 pm One more [] in language\en\cli.php:
They're all throughout phpbb core, you'll find. IIRC if you want an actual reason, it's because using array() was part of phpbb's coding standard, and that has since changed to []. array() is changed to [] in newer code but is left in the older code.

That's what I think anyways, I can't confirm that.
I am a web developer/administrator, specializing in forums. If you have work you need done or are too lazy to do, pm me!

Some of my extensions:
[3.3][BETA] Post Form Templates || [3.3][BETA] Anonymous Posts || [3.2][3.3][BETA] ACP Merge Child Forums || [3.2][BETA] Sticky Ad || [3.2][DEV] User Delete Topics || [3.3][DEV] Moderate While Searching || [3.3][RC] Short Number Twig Extension

Return to “[3.3.x] Translations”