National Flags

How to edit the country names in the dropdown menu? - National Flags

How to edit the country names in the dropdown menu?

by Bruce Banner » Wed Oct 21, 2020 1:13 am

I've just noticed when selecting my flag that some of the country names are messed up. Some of them are in all caps with underscores, e.g. COOK_ISLANDS instead of Cook Islands, or mixed case like CURAçAO. How can I edit these to correct them?
Last edited by Bruce Banner on Thu Dec 24, 2020 4:01 pm
Bruce Banner
Registered User
Posts: 1383
Joined: Thu Sep 25, 2014 10:36 am

Re: How to edit the country names in the dropdown menu?

by RMcGirr83 » Wed Oct 21, 2020 10:37 am

Check the language files or Edit the Flag and change the name.
Former Modifications/Extensions Team Member | My extensions | github | All requests for support via PM will be ignored
Appreciate the extensions/mods/support then you can support me by buying a beer 🍺
User avatar
RMcGirr83
Former Team Member
Posts: 22092
Joined: Wed Jun 22, 2005 4:33 pm
Location: Your display
Name: Rich McGirr

Re: How to edit the country names in the dropdown menu?

by Bruce Banner » Wed Oct 21, 2020 3:14 pm

RMcGirr83 wrote:Check the language files or Edit the Flag and change the name.
This is bizarre. I just checked all the language files, and they're fine, and the flag names are fine in the ACP, but in my dropdown menu in the UCP, Cocos (Keeling) Islands appears as COCOS_(KEELING)_ISLANDS_, Cook Islands appears as COOK_ISLANDS, and Curaçao appears as CURAçAO. I think it might have something to do with the fact that the list of countries in language>en>common.php is not in alphabetical order. The list appears to be in alphabetical order from Afghanistan down to Zimbabwe, but then it starts again with Cocos (Keeling) Islands, and the order from there appears to be random,

Code: Select all

	'COCOS_(KEELING)_ISLANDS ' => 'Cocos (Keeling) Islands ',
	'COOK ISLANDS' => 'Cook Islands',
	'CURACAO' => 'Curaçao',
	'CHRISTMAS_ISLAND' => 'Christmas Island',
	'GIBRALTAR' => 'Gibraltar',
	'SAINT-MARTIN_(FRENCH_PART)' => 'Saint-Martin (French part)',
	'MARTINIQUE' => 'Martinique',
	'NEW_CALEDONIA' => 'New Caledonia',
	'NIUE' => 'Niue',
	'FRENCH_POLYNESIA' => 'French Polynesia',
	'SOUTH_SUDAN' => 'South Sudan',
	'FRENCH_SOUTHERN_TERRITORIES' => 'French Southern Territories',
	'TOKELAU' => 'Tokelau',
	'WALLIS_AND_FUTUNA_ISLANDS' => 'Wallis and Futuna Islands',
	'MAYOTTE' => 'Mayotte',
	'SERBIA' => 'Serbia',
It's also notable that the three countries that have problems in their names in my UCP dropdown menu are all together at the top of that section of code I've highlighted.

Also, in the ACP, the flag for Curaçao is missing. I can see it in the flags folder, where it's named cw, but here are a couple of screenshots of the ACP,

Image

Image

As ya can see in the second screenshot, the filename reads CW.png instead of cw.png as it should. I assume that's the reason the flag isn't showing, because ya must have unknowingly had caps lock on when ya were typing the filename. And here's a screenshot of what I can see in my UCP if I select Curaçao,

Image

Sorry to make ya aware of all these bugs now but it just appears to me that the extension was validated too soon. I'm surprised no one else came across these before I did.
Bruce Banner
Registered User
Posts: 1383
Joined: Thu Sep 25, 2014 10:36 am

Re: How to edit the country names in the dropdown menu?

by RMcGirr83 » Wed Oct 21, 2020 3:38 pm

'COOK ISLANDS' => 'Cook Islands',

missing an underscore, should be

'COOK_ISLANDS' => 'Cook Islands',

and to fix you can simply edit the flags and fix the lang file issues. This should have been caught in validation but it wasn't. No one is perfect.
Former Modifications/Extensions Team Member | My extensions | github | All requests for support via PM will be ignored
Appreciate the extensions/mods/support then you can support me by buying a beer 🍺
User avatar
RMcGirr83
Former Team Member
Posts: 22092
Joined: Wed Jun 22, 2005 4:33 pm
Location: Your display
Name: Rich McGirr

Re: How to edit the country names in the dropdown menu?

by Bruce Banner » Wed Oct 21, 2020 6:07 pm

RMcGirr83 wrote:'COOK ISLANDS' => 'Cook Islands',

missing an underscore, should be

'COOK_ISLANDS' => 'Cook Islands',

and to fix you can simply edit the flags and fix the lang file issues. This should have been caught in validation but it wasn't. No one is perfect.
OK, I added an underscore where ya'd forgotten it and I've managed to fix the name problem with Cook Islands, but I don't know what edits I need to make to fix Cocos (Keeling) Islands, or Curaçao. I experimented and changed the following line of code in language>en>common.php from

Code: Select all

'COCOS_(KEELING)_ISLANDS ' => 'Cocos (Keeling) Islands ',
to

Code: Select all

'COCOS_(KEELING)_ISLANDS_ ' => 'Cocos (Keeling) Islands ',
but that didn't work, so then I noticed there was a space before the second apostrophe in

Code: Select all

'COCOS_(KEELING)_ISLANDS '
and

Code: Select all

'Cocos (Keeling) Islands '
so I tried deleting that space, thereby changing

Code: Select all

'COCOS_(KEELING)_ISLANDS ' => 'Cocos (Keeling) Islands ',
to

Code: Select all

'COCOS_(KEELING)_ISLANDS' => 'Cocos (Keeling) Islands',
but that didn't work either, so I don't know what to do. As for Curaçao, I tried putting in a cedilla in the all caps spelling, thereby changing

Code: Select all

'CURACAO' => 'Curaçao',
to

Code: Select all

'CURAÇAO' => 'Curaçao',
but that didn't work. I don't know what to do. I also don't know how to fix the Curaçao flag issue. I don't know which file to look in to change CW.png to cw.png so that the flag will show up in the ACP and UCP.
Bruce Banner
Registered User
Posts: 1383
Joined: Thu Sep 25, 2014 10:36 am

Re: How to edit the country names in the dropdown menu?

by RMcGirr83 » Wed Oct 21, 2020 7:28 pm

The curacao image is being stored in the DB as CW.png which is why it displays like that. Go into the database and in the flags table find curacao and change the flag image name to cw.png then purge the cache. As far as cocos goes, it's displaying properly for me by simply removing the extra space.
The cedilla doesn't matter, what does matter is the spelling of the name in the ACP and the spacing per this.

https://github.com/rmcgirr83/nationalfl ... hp#L55-L57

Don't know how I missed it but with 200+ flags I suppose one or two are going to be missed. I'll try and update the extension on here sometime this week for validation.
Former Modifications/Extensions Team Member | My extensions | github | All requests for support via PM will be ignored
Appreciate the extensions/mods/support then you can support me by buying a beer 🍺
User avatar
RMcGirr83
Former Team Member
Posts: 22092
Joined: Wed Jun 22, 2005 4:33 pm
Location: Your display
Name: Rich McGirr

Re: How to edit the country names in the dropdown menu?

by Bruce Banner » Wed Oct 21, 2020 7:54 pm

RMcGirr83 wrote:The curacao image is being stored in the DB as CW.png which is why it displays like that. Go into the database and in the flags table find curacao and change the flag image name to cw.png then purge the cache. As far as cocos goes, it's displaying properly for me by simply removing the extra space.
The cedilla doesn't matter, what does matter is the spelling of the name in the ACP and the spacing per this.

https://github.com/rmcgirr83/nationalfl ... hp#L55-L57

Don't know how I missed it but with 200+ flags I suppose one or two are going to be missed. I'll try and update the extension on here sometime this week for validation.
I don't know how to go into the database. I know how to change code in extension files and reupload them but I don't know how to "go into" the database. When ya say removing the extra space for cocos, do ya mean changing this

Code: Select all

'COCOS_(KEELING)_ISLANDS ' => 'Cocos (Keeling) Islands ',
to

Code: Select all

'COCOS_(KEELING)_ISLANDS' => 'Cocos (Keeling) Islands',
?

Because, if so, that's just not working for me. I've tried it several times now. I delete that space, reupload common,php, purge the cache, hard refresh the browser, go back into the UCP, pull down the dropdown menu, and it's still listed as COCOS_(KEELING)_ISLANDS_
Bruce Banner
Registered User
Posts: 1383
Joined: Thu Sep 25, 2014 10:36 am

Re: How to edit the country names in the dropdown menu?

by RMcGirr83 » Thu Oct 22, 2020 2:39 am

And what is the entry in the ACP for Cocos? Just wait for the next version.
Former Modifications/Extensions Team Member | My extensions | github | All requests for support via PM will be ignored
Appreciate the extensions/mods/support then you can support me by buying a beer 🍺
User avatar
RMcGirr83
Former Team Member
Posts: 22092
Joined: Wed Jun 22, 2005 4:33 pm
Location: Your display
Name: Rich McGirr

Re: How to edit the country names in the dropdown menu?

by Bruce Banner » Thu Oct 22, 2020 4:56 pm

RMcGirr83 wrote:And what is the entry in the ACP for Cocos? Just wait for the next version.
Don't understand what ya mean. Do ya mean what's its name in the ACP? It says what it's supposed to, Cocos (Keeling) Islands. But in my UCP dropdown menu, it still shows up as COCOS_(KEELING)_ISLANDS_. I just can't figure out what the problem could be.

EDIT: Oh wait. I just clicked in the Flag Name box in the ACP and found there was an extra space after Islands, so I hit backspace, clicked Submit, went back to my UCP dropdown menu, and found that the third underscore is now gone, so it now says COCOS_(KEELING)_ISLANDS. I just can't figure out where the underscores are coming from and why it's in all caps. And I can't figure out CURAçAO either.
Bruce Banner
Registered User
Posts: 1383
Joined: Thu Sep 25, 2014 10:36 am

Re: How to edit the country names in the dropdown menu?

by Bruce Banner » Mon Dec 07, 2020 5:09 pm

Just downloaded and tested the new updated version. All the spelling errors I spotted are fixed but, unfortunately, there's still a problem with Curaçao. When you select it from the dropdown menu in the user control panel, instead of the flag, you just get the name Curaçao.
Bruce Banner
Registered User
Posts: 1383
Joined: Thu Sep 25, 2014 10:36 am

Re: How to edit the country names in the dropdown menu?

by RMcGirr83 » Tue Dec 08, 2020 12:35 am

Can't reproduce any of this
acp.PNG
profile.PNG
profile.PNG (7.86 KiB) Viewed 76 times
index.PNG
flag.PNG
flag.PNG (10.88 KiB) Viewed 80 times
flag_users.PNG
flag_users.PNG (9.56 KiB) Viewed 73 times
Is the name of the flag correct (cw.png) capitalization matters.
Former Modifications/Extensions Team Member | My extensions | github | All requests for support via PM will be ignored
Appreciate the extensions/mods/support then you can support me by buying a beer 🍺
User avatar
RMcGirr83
Former Team Member
Posts: 22092
Joined: Wed Jun 22, 2005 4:33 pm
Location: Your display
Name: Rich McGirr

Re: How to edit the country names in the dropdown menu?

by Bruce Banner » Wed Dec 09, 2020 8:06 pm

I don't know how to explain it but there is some kind of weird bug in the extension that I can apparently only fix using Atom because I've tried fixing it using Notepad++ and it doesn't work. If I use Atom to search the extension for cura, as in Curaçao, these are the results I get,

Image

Look at line 34 in migrations\m13_update_data.php

If you zoom in, ya'll see that, in place of the ç in Curaçao, there's a weird sorta diamond-shaped symbol with a question mark in it. If ya look at that same line of code in Notepad++, that symbol isn't there. It just says Curaçao. If I try using Notepad++ to fix the weird problem and replace the ç in Curaçao with a ç (in other words, not replace it at all but just delete and then retype it), and then I repeat the Atom search for cura, that symbol will still be there, unchanged. But if I click on it in Atom, bringing up a tab that shows that particular file, with Curaçao highlighted but with that weird symbol in place of the ç, and I delete the weird symbol and replace it with a ç, THEN the Atom search shows that I HAVE deleted the weird symbol and replaced it with a ç. If I delete the weird symbol in line 34 of m13_update_data.php OR in line 912 of m6_update_data.php, or both, and then upload and install the extension, THEN the correct Curaçao flag shows in the dropdown menu when I select Curaçao, but if all I do is just download the extension and then upload and install it unaltered, then if I select Curaçao from the dropdown menu, all I get is the word Curaçao.
Bruce Banner
Registered User
Posts: 1383
Joined: Thu Sep 25, 2014 10:36 am

Re: How to edit the country names in the dropdown menu?

by RMcGirr83 » Thu Dec 10, 2020 11:17 am

The encoding for m13_update_data is set to ANSI. That's the problem, it needs to be UTF8. Nice catch but I doubt if I'll update the extension for this. I'll see if I can get a repack on the current version.
Former Modifications/Extensions Team Member | My extensions | github | All requests for support via PM will be ignored
Appreciate the extensions/mods/support then you can support me by buying a beer 🍺
User avatar
RMcGirr83
Former Team Member
Posts: 22092
Joined: Wed Jun 22, 2005 4:33 pm
Location: Your display
Name: Rich McGirr

Re: How to edit the country names in the dropdown menu?

by Bruce Banner » Thu Dec 10, 2020 12:01 pm

RMcGirr83 wrote:The encoding for m13_update_data is set to ANSI. That's the problem, it needs to be UTF8. Nice catch but I doubt if I'll update the extension for this. I'll see if I can get a repack on the current version.
In your previous post, you showed that you weren't able to reproduce the problem yourself. I don't understand why. As there is indeed actually a slight issue to do with encoding, why did you not get the same problem I did, with just the word Curaçao showing in the dropdown instead of the flag?
Bruce Banner
Registered User
Posts: 1383
Joined: Thu Sep 25, 2014 10:36 am

Re: How to edit the country names in the dropdown menu?

by RMcGirr83 » Thu Dec 10, 2020 9:39 pm

Don't know but it is what it is and that was the reason as to why you had the issue you were having. Maybe out database collations don't match but it doesn't do any good to continue. I have to submit a new version to fix this issue and will be doing so in the next coming days.
Former Modifications/Extensions Team Member | My extensions | github | All requests for support via PM will be ignored
Appreciate the extensions/mods/support then you can support me by buying a beer 🍺
User avatar
RMcGirr83
Former Team Member
Posts: 22092
Joined: Wed Jun 22, 2005 4:33 pm
Location: Your display
Name: Rich McGirr