Problem with placeholders in italian

Having a question about translating phpBB 3.2? Want to discuss and collaborate with people currently translating phpBB 3.2? Here would be the correct place to do so.
Lord Phobos
Registered User
Posts: 935
Joined: Tue May 18, 2004 11:41 pm

Problem with placeholders in italian

Post by Lord Phobos »

Hi

My board (www.anonimagiocatori.it) has a problem with placeholders in ucp.php in italian language (the official one, downloaded from here).

Let's say, the avatar section.
In english I see correctly:
Current image:
Maximum dimensions; width: 160 pixels, height: 160 pixels.
But in italian I see:
Immagine attuale:
Dimensioni massime - larghezza: pixel, altezza: pixel.
The numbers are gone.
The same happens in other sections of the profile.

Besides the word, the lang keys are identical. Here they are, first english then italian:

Code: Select all

	'AVATAR_EXPLAIN_NO_FILESIZE'	=> 'Maximum dimensions; width: %1$s, height: %2$s.',

Code: Select all

	'AVATAR_EXPLAIN_NO_FILESIZE'	=> 'Dimensioni massime - larghezza: %1$s, altezza: %2$s.',
Could you please help me?
Where is the problem?

Thanks in advance.
Last edited by Mick on Thu Oct 18, 2018 8:45 am, edited 1 time in total.
User avatar
EA117
Registered User
Posts: 2171
Joined: Wed Aug 15, 2018 3:23 am

Re: Problem with placeholders in italian

Post by EA117 »

Lord Phobos wrote: Wed Oct 17, 2018 9:28 pm

Code: Select all

	'AVATAR_EXPLAIN_NO_FILESIZE'	=> 'Dimensioni massime - larghezza: %1$s, altezza: %2$s.',
Maybe try the current version of the Italian language pack for whichever phpBB version you're using. Because none of the current versions I see available for download have the definition of AVATAR_EXPLAIN_NO_FILESIZE specifically as 'Dimensioni massime - larghezza: %1$s, altezza: %2$s.' that you're showing here.

So I'm having to assume you're looking at an older or modified language pack of some sort. Not that I see anything specifically wrong in why the definition as shown wouldn't have still worked; just trying to eliminate this or any other differences that may exist in your files as compared to the current official release, in order to assert that there is even still an issue.

Note the definition of the 'PIXELS' array from the common.php language-specific module is also playing a role here, in addition to the language-specific ucp.php's AVATAR_EXPLAIN_NO_FILESIZE definition.
Lord Phobos
Registered User
Posts: 935
Joined: Tue May 18, 2004 11:41 pm

Re: Problem with placeholders in italian

Post by Lord Phobos »

No, I just modified changing from ": " to " - ", the file is ok.
Even just copying exactly the lang key, still not working.
Last edited by Lord Phobos on Thu Oct 18, 2018 12:19 am, edited 1 time in total.
Lord Phobos
Registered User
Posts: 935
Joined: Tue May 18, 2004 11:41 pm

Re: Problem with placeholders in italian

Post by Lord Phobos »

EA117 wrote: Wed Oct 17, 2018 10:25 pm
Note the definition of the 'PIXELS' array from the common.php language-specific module is also playing a role here, in addition to the language-specific ucp.php's AVATAR_EXPLAIN_NO_FILESIZE definition.
I see.
The problem is that in italian there is no plural to "pixel", so the common.php lang file in that part looks like so:

Code: Select all

	'PIXEL'					=> 'px',
	'PIXELS'				=> array(
		1	=> '%d pixel',
		2	=> '%d pixel',
	),
How can I fix?

Thanks.
User avatar
EA117
Registered User
Posts: 2171
Joined: Wed Aug 15, 2018 3:23 am

Re: Problem with placeholders in italian

Post by EA117 »

Yeah, not knowing Italian, I assumed there must not be any plural form of "pixel", else someone would have already fixed it. That's not an issue or problem to correct, if indeed "pixel" is also correct for describing multiple pixels. Those two strings don't have to be different, they just can be different, if that's proper for the language.

That the language-specific common.php didn't also have unexpected modifications, and/or that the "%d" wasn't missing out of those array strings for PIXELS, is the thing I would have been primarily concerned with. e.g. If those two strings had been just "pixel" instead of "%d pixel", then this would have completely explained the output you are seeing.

But seeing "1 => '%d pixel'," and "2 => '%d pixel'," looks exactly correct, and is as expected. Those instances of "%d" should have been replaced by the numbers retrieved as "$config['avatar_max_width']" and "$config['avatar_max_height'])" in the main non-language-specific functions_user.php module, same as they successfully are when English language is selected when generating the AVATAR_EXPLAIN_NO_FILESIZE
message.

Since you're saying overwriting the Italian language directory with the unmodified official release files still shows the same issue, I don't have an explanation for how that's possible, given the contents of the files being shown here. The only Hail Mary I have is that after you overwrite the Italian language with the official unmodified files, can you also be sure to clear your cache, so that we're not still being served a copy of "the way things were before."
User avatar
3Di
I've Been Banned!
Posts: 17538
Joined: Mon Apr 04, 2005 11:09 pm
Location: I'm with Ukraine 🇺🇦
Name: Marco

Re: Problem with placeholders in italian

Post by 3Di »

Lord Phobos wrote: Thu Oct 18, 2018 12:18 am The problem is that in italian there is no plural to "pixel"
The plural of pixel in Italian is pixels.
Pixel is not an Italian word.

Moreover, I see that the dictionaries have pixel(s) as a noun, so pixel. But in my opinion this is not correct.

Do you say: 1 Espresso / 2 Espressi or 1 Espresso / 2 Espresso?
🆓 Free support for our extensions also provided here: phpBB Studio
🚀 Looking for a specific feature or alternative option? We will rock you!
Please PM me only to request paid works. Thx. Buy me a coffee -> Image
My development's activity º PhpStorm's proud user º Extensions, Scripts, MOD porting, Update/Upgrades
User avatar
EA117
Registered User
Posts: 2171
Joined: Wed Aug 15, 2018 3:23 am

Re: Problem with placeholders in italian

Post by EA117 »

Thanks 3Di. Just to come full circle, I temporarily set the PIXELS array to two identical strings in my installed English language pack too, so that both were "%d pixel". As expected, phpBB doesn't care if they're the same, and displayed "150 pixel" instead of "150 pixels" in my English language.

The bad news is, since I had already gone this far, I went ahead and installed the current Italian 3.2.3 language pack files on my phpBB 3.2.2 board. And this message displays perfectly fine for me: "Dimensioni massime; larghezza: 150 pixel, altezza: 150 pixel."

So I'm STILL left believing there is something different / modified / unexpected about the Italian language pack files; if selecting English on that board shows this message correctly, but selecting Italian omits the numeric portion of that same message.

EDIT: Either that, or the previously recommendation to be sure the cache was cleared after overwriting with the shipping Italian files again might be what was keeping the change from showing success.
Lord Phobos
Registered User
Posts: 935
Joined: Tue May 18, 2004 11:41 pm

Re: Problem with placeholders in italian

Post by Lord Phobos »

3Di wrote: Thu Oct 18, 2018 12:48 am
Lord Phobos wrote: Thu Oct 18, 2018 12:18 am The problem is that in italian there is no plural to "pixel"
The plural of pixel in Italian is pixels.
Pixel is not an Italian word.

Moreover, I see that the dictionaries have pixel(s) as a noun, so pixel. But in my opinion this is not correct.

Do you say: 1 Espresso / 2 Espressi or 1 Espresso / 2 Espresso?
In correct italian we don't use the plural for foreign words: 1 computer is 1 computer; 12 computers are 12 computer.
User avatar
3Di
I've Been Banned!
Posts: 17538
Joined: Mon Apr 04, 2005 11:09 pm
Location: I'm with Ukraine 🇺🇦
Name: Marco

Re: Problem with placeholders in italian

Post by 3Di »

Lord Phobos wrote: Thu Oct 18, 2018 1:10 am
3Di wrote: Thu Oct 18, 2018 12:48 am
Lord Phobos wrote: Thu Oct 18, 2018 12:18 am The problem is that in italian there is no plural to "pixel"
The plural of pixel in Italian is pixels.
Pixel is not an Italian word.

Moreover, I see that the dictionaries have pixel(s) as a noun, so pixel. But in my opinion this is not correct.

Do you say: 1 Espresso / 2 Espressi or 1 Espresso / 2 Espresso?
In correct italian we don't use the plural for foreign words: 1 computer is 1 computer; 12 computers are 12 computer.
As reported here, I know: http://www.treccani.it/magazine/lingua_ ... a_391.html
Still I am getting hard time to digest all of this though, it could be that I am living outside of Italy since a long time. :)

Back to the topic, it doesn't matter a trailing s in your case, the logic works per se.
Your issue lies elsewhere.
🆓 Free support for our extensions also provided here: phpBB Studio
🚀 Looking for a specific feature or alternative option? We will rock you!
Please PM me only to request paid works. Thx. Buy me a coffee -> Image
My development's activity º PhpStorm's proud user º Extensions, Scripts, MOD porting, Update/Upgrades
Lord Phobos
Registered User
Posts: 935
Joined: Tue May 18, 2004 11:41 pm

Re: Problem with placeholders in italian

Post by Lord Phobos »

I noticed I also have similar placeholder issues elsewhere: the order of last edited in viewtopic is screwed, no number of digits in the registration form...
Modificato l’ultima volta da 3 il Phobos; modificato 18 volte in totale
should be
Modificato l’ultima volta da Phobos il 18 ottobre 2018; modificato 3 volte in totale
Clearing cache (both in board ACP and in browser is of no avail.
Please help me :lol: , I can give you access to my board and whichever file do you want.
User avatar
EA117
Registered User
Posts: 2171
Joined: Wed Aug 15, 2018 3:23 am

Re: Problem with placeholders in italian

Post by EA117 »

PM sent.
User avatar
Mick
Support Team Member
Support Team Member
Posts: 26833
Joined: Fri Aug 29, 2008 9:49 am

Re: Problem with placeholders in italian

Post by Mick »

You should be posting in the dedicated discussion/support area for your language here if there are genuine issues with the pack. The author needs to be aware.
  • "The more connected we get the more alone we become” - Kyle Broflovski© 🇬🇧
User avatar
EA117
Registered User
Posts: 2171
Joined: Wed Aug 15, 2018 3:23 am

Re: Problem with placeholders in italian

Post by EA117 »

After being able to analyze the snapshots you were willing to provide of your current site files:
Lord Phobos wrote: Wed Oct 17, 2018 9:28 pm But in italian I see:
Immagine attuale:
Dimensioni massime - larghezza: pixel, altezza: pixel.
The numbers are gone.
I am not versed enough in phpBB extension design to confirm exactly how and why it's able to come into play within the UCP, but the /ext/phpbbGallery/core/language/it/gallery.php module's definition of the $lang interface contains a "PIXELS" array definition which matches & explains the behavior you are seeing with regard to "Dimensioni massime - larghezza: pixel, altezza: pixel."

Meaning the "PIXELS" definition in that array from the phpbbGallery extension's Italian language directory module defines just "pixel", and not "%d pixel". Which exactly matches the incorrect output that you are seeing. This also explains why I do not see the issue -- even when installing your exact Italian language pack files on my board -- since I do not have the phpbbGallery extension.

It's notable that the official downloads for phpbbGallery 1.2.0.11 (https://www.phpbb.com/customise/db/exte ... b_gallery/) or the subsequent 1.2.1 through 3.2.2 releases (https://github.com/satanasov/phpbbgallery) do not actually contain an Italian language directory. So my best guess is that this is an Italian language pack for an older version of the phpbbGallery extension, or a user-contributed Italian language pack for the extension, which defines "PIXELS" as a $lang message in a way that is incompatible with phpbb 3.2.x boards (and maybe even phpBB 3.1.x).

What is clear is that the English language and other languages that are included with phpbbGallery extension installed on your board do not make this mistaken "PIXELS" $lang definition. Which would apparently explain why the English language or other non-Italian languages are not presenting this issue.

To test and confirm this is the root cause, you should disable or remove the phpbbGallery extension. To determine how to correctly support the Italian language using the current 3.2.2 version of https://github.com/satanasov/phpbbgallery, you should discuss this point in the phpbbGallery extension discussion area (https://www.phpbb.com/customise/db/exte ... ry/support) and determine how to attain Italian language support for the current version of this extension.
Lord Phobos wrote: Thu Oct 18, 2018 1:17 am I noticed I also have similar placeholder issues elsewhere: the order of last edited in viewtopic is screwed, no number of digits in the registration form...
Modificato l’ultima volta da 3 il Phobos; modificato 18 volte in totale
should be
Modificato l’ultima volta da Phobos il 18 ottobre 2018; modificato 3 volte in totale
This issue is occurring due to a /language/it/viewtopic.php module file on your board which has been modified, and does not match the official 3.2.3 Italian language pack download. Specifically, the EDITED_TIMES_TOTAL definition was changed from:

Code: Select all

'Ultima modifica di %2$s il %3$s, modificato %1$d volta in totale.'
to:

Code: Select all

'Ultima modifica di %1$s il %2$s, modificato %3$d volta in totale.'
That's just wrong in all ways, since not only is the order incorrect for the way EDITED_TIMES_TOTAL is called, but the type specifiers ("d" versus "s") didn't follow the ordered values either. Meaning it's now trying to print a numbers as strings and vice-versa, in addition to wrong values at wrong positions within the message.

You indicated via PM that this modification is due to the "Post Edit Log" extension. Although you might be more correct than I am able to ascertain, this assertion does not make sense to me. Because I do not expect for the extension installation to modify main phpBB files (as is the extension framework design), and also because I don't see Italian language support for this extension.

Regardless of how it got there though, returning the Italian language definition of EDITED_TIMES_TOTAL in /language/it/viewtopic.php to be 'Ultima modifica di %2$s il %3$s, modificato %1$d volta in totale.' is the solution. Or, simply re-applying the 3.2.3 Italian language pack files, which already contain this definition.

And same as in the earlier case, consulting with the "Post Edit Log" extension support topic area (https://www.phpbb.com/customise/db/exte ... _2/support) on how to achieve phpBB 3.2.3 compatibility for this extension, as well as successful Italian language support for this version.


To be clear, the conclusion we have here is not of any problem with the Italian language pack for phpBB 3.2.3, nor with phpBB itself. The issue is with extensions and/or edits made against the Italian language files; in the phpBB language directory for Italian, and in the extension-specific language directories for Italian.
Lord Phobos
Registered User
Posts: 935
Joined: Tue May 18, 2004 11:41 pm

Re: Problem with placeholders in italian

Post by Lord Phobos »

Hi, you were right: placeholder problem in avatar and account sections of the UCP were caused by the phpbb gallery extension.
Disabled it -> now working as intended.

About the modified file you see for edited messages, I tried to change it AFTER noticing the error, not before.
User avatar
EA117
Registered User
Posts: 2171
Joined: Wed Aug 15, 2018 3:23 am

Re: Problem with placeholders in italian

Post by EA117 »

Lord Phobos wrote: Fri Oct 19, 2018 1:32 pm About the modified file you see for edited messages, I tried to change it AFTER noticing the error, not before.
You are correct; I missed identifying an additional factor when it came to the EDITED_TIMES_TOTAL message. The fact that the manually-edited message with incorrect order caused exactly the issue described when I installed your Italian language pack files "tricked" me into thinking that was the only problem. I missed the fact there are actually two reasons shown in the installed files, both of which can cause that same issue.

It's once again the phpbbGallery extension, or more specifically, the Italian language pack that is installed for the phpbbGallery extension. Similar to how that Italian gallery.php module had re-defined "PIXELS", I completely missed that this same gallery.php module is also re-defining the "EDITED_TIMES_TOTAL" message, too.

The /ext/phpbbgallery/core/language/it/gallery.php is defining that message as "Modificato l’ultima volta da %s il %s; modificato %d volte in totale". It's the correct message, but with the order information removed / created before phpBB had introduced the order specifiers for placeholders.

As such, the phpbbGallery definition of EDITED_TIMES_TOTAL is equivalent to the manually-edited wrong message, because it's trying to print information in the incorrect order, and is trying to print numbers as strings and vice-versa.
Lord Phobos wrote: Fri Oct 19, 2018 1:32 pm placeholder problem in avatar and account sections of the UCP were caused by the phpbb gallery extension.
Disabled it -> now working as intended.
And... the "number of times this message has been edited" issue is also addressed now? After having disabled the phpbbGallery extension, and after having reverted back to the unmodified 3.2.3 Italian language pack files for phpBB itself, and then having cleared the cache?

Because that is what it looks like now; that the "rogue" Italian language pack files being used for the phpbbGallery extension was actually the root cause of both issues. And as you said, the manual edit to the phpBB Italian language pack was just an attempt "after the fact" to correct the issue.

Return to “[3.2.x] Translations”