Page 1 of 2

Change to flag BBCode

Posted: 2017-08-15, 22:25
by Yserenhart
For site security reasons the way that the flag BBCode works internally has been changed. As a result, most existing usages have broken. The problem comes from the optional descriptive text (which was intended to allow the name of the language to be added for people to see when hovering over the flag) now being considered required when the code is parsed. To fix existing flags, and for future usage there are now two options:

Code: Select all

[flag={TEXT}]{LANGUAGE CODE}[/flag]

If you use this you must include the descriptive text, even just a space, to make it work. The supported characters for the descriptive text are Unicode letter characters, numbers, spaces, commas, dots, minus, plus, hyphen, underscore, and white-spaces.

Code: Select all

[flag]{LANGUAGE CODE}[/flag]

This will display the flag and link to a wikipedia page on click, as the other one does, but has no possibility for descriptive text.

Re: Change to flag BBCode

Posted: 2017-08-16, 4:34
by dEhiN
It seems though that the complex flag codes don't work anymore, using either method. I've tried both en-ca and en-CA with both using a descriptive text and without, and nothing works.

Re: Change to flag BBCode

Posted: 2017-08-16, 6:04
by OldBoring
Nobody cares aboot Kneeyidiuhn English eh.

Re: Change to flag BBCode

Posted: 2017-08-16, 7:52
by Yserenhart
dEhiN wrote:It seems though that the complex flag codes don't work anymore, using either method. I've tried both en-ca and en-CA with both using a descriptive text and without, and nothing works.

They do still work; however, some image files seem to missing now, resulting in the no-flag icon instead—the text and wikipedia linking still work fine. That's nothing to do with the code change though.

Re: Change to flag BBCode

Posted: 2017-08-16, 15:14
by linguoboy
Why does the ISO 639-3 code for Osage (osa) lead to the Wikipedia article on Humahuaca?

Re: Change to flag BBCode

Posted: 2017-08-16, 16:01
by Yserenhart
linguoboy wrote:Why does the ISO 639-3 code for Osage (osa) lead to the Wikipedia article on Humahuaca?

Because Wikipedia redirect pages. For whatever reason, all the newly added languages are going to "{CODE} language" instead of "{EN NAME OF LANGUAGE} language".

Re: Change to flag BBCode

Posted: 2017-08-16, 16:58
by Luís
Yserenhart wrote:They do still work; however, some image files seem to missing now, resulting in the no-flag icon instead—the text and wikipedia linking still work fine. That's nothing to do with the code change though.


The images aren't missing. But it seems we lost some rules in decoding the language codes since yesterday's migration of langicon.php. Check issue #21 on Github. I tried to fix it, but to no avail.

Yserenhart wrote:For whatever reason, all the newly added languages are going to "{CODE} language" instead of "{EN NAME OF LANGUAGE} language".


I suppose that's because wikidirect.php is still on the old site pointing to an old lang_data file. proycon opened an issue on Github yesterday to migrate it as well.

Re: Change to flag BBCode

Posted: 2017-08-16, 19:01
by Yserenhart
Luís wrote:
Yserenhart wrote:They do still work; however, some image files seem to missing now, resulting in the no-flag icon instead—the text and wikipedia linking still work fine. That's nothing to do with the code change though.


The images aren't missing. But it seems we lost some rules in decoding the language codes since yesterday's migration of langicon.php. Check issue #21 on Github. I tried to fix it, but to no avail.

The simple fix for that is to copy the appropriate country flags to /phpBB3/ext/unilang/languages/styles/all/theme/images/langicons/ and give them the proper complex code. That's how it is for some of them already (ex. nl-BE).

Re: Change to flag BBCode

Posted: 2017-08-16, 19:22
by Yserenhart
The ownflag code has also been changed, in the same manner as the flag code. Same problem, same fix, same alternatives (just with "ownflag" instead of "flag").

Re: Change to flag BBCode

Posted: 2017-08-16, 19:25
by Luís
Yserenhart wrote:The simple fix for that is to copy the appropriate country flags to /phpBB3/ext/unilang/languages/styles/all/theme/images/langicons/ and give them the proper complex code. That's how it is for some of them already (ex. nl-BE).


I wouldn't call that a "simple" fix, considering the amount of files involved, but it's a solution.

You'd still lose ad-hoc codes, though. Up until yesterday I could use, for instance,

Code: Select all

[flag]pt-AO[/flag]
to make the flag of Angola show up, while Angolan Portuguese is not even an option in the language list.

Re: Change to flag BBCode

Posted: 2017-08-16, 19:47
by Yserenhart
Luís wrote:
Yserenhart wrote:The simple fix for that is to copy the appropriate country flags to /phpBB3/ext/unilang/languages/styles/all/theme/images/langicons/ and give them the proper complex code. That's how it is for some of them already (ex. nl-BE).


I wouldn't call that a "simple" fix, considering the amount of files involved, but it's a solution.

Simple in that it's just copy-pasting and renaming, as opposed to trying to get working code.


You'd still lose ad-hoc codes, though. Up until yesterday I could use, for instance,

Code: Select all

[flag]pt-AO[/flag]
to make the flag of Angola show up, while Angolan Portuguese is not even an option in the language list.

Better to have the language-list languages working properly and lose ad-hoc codes in the short term, in my opinion. I would also say that a major national variant of a world language should definitely be in the language list.

Re: Change to flag BBCode

Posted: 2017-08-16, 20:25
by Luís
I fixed the code, everything should be working properly again.

I also fixed the wikipedia redirects, they should work for new languages as well.

(see)

linguoboy wrote:Why does the ISO 639-3 code for Osage (osa) lead to the

Wikipedia article on Humahuaca?


It doesn't anymore.

(osa)

Re: Change to flag BBCode

Posted: 2017-08-17, 19:34
by voron
We already had a change from

Code: Select all

[flag]code[/flag]
to

Code: Select all

[flag=]code[/flag]
a few years ago, right? So we're now changing it back, meaning that some older topics which were broken should now again display the flags correctly, shouldn't they? But it doesn't seem to be the case, for example in this topic the flags are still broken:
viewtopic.php?f=11&t=37054

I wonder why...
It's interesting that if I click "quote" and "preview" on some of those older posts, the flags display correctly again.

Re: Change to flag BBCode

Posted: 2017-08-17, 19:36
by vijayjohn
Wait, we're changing it back? I thought it was changed to a third format this time. :hmm:
voron wrote:It's interesting that if I click "quote" and "preview" on some of those older posts, the flags display correctly again.

Maybe that's because some of the language codes have changed over the years, e.g. we now have pt-BR for Brazilian Portuguese instead of pt-br.

Re: Change to flag BBCode

Posted: 2017-08-17, 19:42
by voron
vijayjohn wrote:Wait, we're changing it back?

Yeah sounds crazy right? I remember how I was upset that we broke a lot of old posts with this change, but this time I couldn't care less. :whistle:

Re: Change to flag BBCode

Posted: 2017-08-17, 20:51
by Luís
voron wrote:I wonder why...
It's interesting that if I click "quote" and "preview" on some of those older posts, the flags display correctly again.


Also if you edit it. It seems they need to be reparsed, so no luck there... :cry:

vijayjohn wrote:Maybe that's because some of the language codes have changed over the years, e.g. we now have pt-BR for Brazilian Portuguese instead of pt-br.


Just changed it to be case insensitive, so now for instance both pt-br and pt-BR will work.

Re: Change to flag BBCode

Posted: 2017-08-18, 3:16
by dEhiN
Luís wrote:
vijayjohn wrote:Maybe that's because some of the language codes have changed over the years, e.g. we now have pt-BR for Brazilian Portuguese instead of pt-br.


Just changed it to be case insensitive, so now for instance both pt-br and pt-BR will work.

Oh yay, I'm glad! I used to use en-ca but found that wasn't working anymore, so I put en-CA. But now I can be lazy again! :D

Re: Change to flag BBCode

Posted: 2017-08-27, 19:50
by Bubulus
You guys don't know how mortified I feel for having pushed the use of flags to identify languages years ago. Regret and shame, that's what I feel.

:cry: :cry: :cry:

My thinking now is that it was actually better to just use the names of the languages, like this:

Portuguese: um dente
Spanish: un diente
Catalan: una dent
French: une dent
Italian: un dente
Romanian: un dinte

Re: Change to flag BBCode

Posted: 2017-08-28, 2:41
by linguoboy
Same. I'm not at all fond of how it reinforces the myth of one country = one language.

Re: Change to flag BBCode

Posted: 2017-08-28, 6:21
by md0
Maybe what could happen is that the flag BBCode generates a different HTML output, and not an image. So we keep the shorthand, but we get rid of the flags.

Something like [Native Lang Name] + [Lang Code: English Name Tooltip].

Code: Select all

<dfn><abbr title="pt-BR: Brazilian Portuguese">Português do Brasil</abbr></dfn>


You'd see Português do Brasil, and if you hover over it, then you'll see pt-BR: Brazilian Portuguese as a tooltip.