Giter Club home page Giter Club logo

biter777 / countries Goto Github PK

View Code? Open in Web Editor NEW
367.0 8.0 69.0 1.4 MB

Countries - ISO-639, ISO-3166 countries codes with subdivisions and names, ISO-4217 currency designators, ITU-T E.164 IDD phone codes, countries capitals, UN M.49 codes, IANA ccTLD countries domains, FIPS, IOC/NOC and FIFA codes, VERY VERY FAST, compatible with Databases/JSON/BSON/GOB/XML/CSV, Emoji countries flags and currencies, Unicode CLDR.

Home Page: https://pkg.go.dev/github.com/biter777/countries?tab=doc

License: BSD 2-Clause "Simplified" License

Go 100.00%
go iso iso3166 iso3166-1 iso3166-2 iso4217 currency currencies money iso-3166

countries's Issues

Official Turkish country name not recognised

As of December 2021, Turkey was renamed to Türkiye (full, Republic of Türkiye). This change has been recognised and adopted by the UN, WTO and NATO as of July 2022 [cite] [cite] and US State Department as of January 2023 [cite].

It would be great if the package could be updated to reflect this change.

Current name resolution

Resolves Name
Turkey
Republic of Türkiye
Türkiye

[DepShield] (CVSS 5.9) Vulnerability due to usage of golang.org/x:crypto:0.0.0-20190308221718-c2843e01d9a2

Vulnerabilities

DepShield reports that this application's usage of golang.org/x:crypto:0.0.0-20190308221718-c2843e01d9a2 results in the following vulnerability(s):


Occurrences

golang.org/x:crypto:0.0.0-20190308221718-c2843e01d9a2 is a transitive dependency introduced by the following direct dependency(s):

github.com/jinzhu:gorm:1.9.12
        └─ golang.org/x:crypto:0.0.0-20191205180655-e7c4368fe9dd
              └─ golang.org/x:net:0.0.0-20190404232315-eb5bcb51f2a3
                    └─ golang.org/x:crypto:0.0.0-20190308221718-c2843e01d9a2

This is an automated GitHub Issue created by Sonatype DepShield. Details on managing GitHub Apps, including DepShield, are available for personal and organization accounts. Please submit questions or feedback about DepShield to the Sonatype DepShield Community.

Add native names

I am missing native names when I want to provide users with options to pick their country. It's all in English which does not make sense in certain situations.

So for example:
Hungary -> Magyarország
Slovakia -> Slovensko
Czechia -> Česko
Austria -> Österreich
Spain -> España
Russia -> Россия
Bulgaria -> България
China -> 中國

and so on.

UN M49 region codes

Are these code correct?

const (
	// RegionAfrica       RegionCode = 2
	RegionAfrica RegionCode = 2
	// RegionNorthAmerica RegionCode = 3
	RegionNorthAmerica RegionCode = 3
	// RegionSouthAmerica RegionCode = 5
	RegionSouthAmerica RegionCode = 5
	// RegionOceania      RegionCode = 9
	RegionOceania RegionCode = 9
	// RegionAntarctica   RegionCode = 999
	RegionAntarctica RegionCode = 999
	// RegionAsia         RegionCode = 142
	RegionAsia RegionCode = 142
	// RegionEurope       RegionCode = 150
	RegionEurope RegionCode = 150
)

It seems to me that North America and South America codes are wrong.
See here.

Chile has a currency bug

HI!
Thanks for the project, this is awesome work!

I found a bug in my project when using it in production environment, that the Chilean currency is Chilean Peso (CLP) instead of Chilean Unidad de Fomento (CLF).

I hope this bug will be fixed soon.

Add country languages

HI!
Thanks for the project, this is awesome work!

I'm using your library to import geolocation data and need the official languages by a country.

To solve that, I'm building a list of country codes and languages.

WDYT about put this info inside the library? If ok for you I can open a PR for these.

Use 'v' prefix in tags

Could you please use 'v1.4.0' for your tags? Go mod can't properly vendor tags like '1.4.0', it needs 'v' in the beginning.
Thanks!

Add below countries

AFG','BHR','BGD','BRN' add above country codes and respective country related details if missing

more names to identify country names

MACEDONIA, THE FORMER YUGOSLAV REPUBLIC OF => North Macedonia
VENEZUELA, BOLIVARIAN REPUBLIC OF => Venezuela
MOLDOVA, REPUBLIC OF => Moldova
TAIWAN, PROVINCE OF CHINA =>Taiwan
PALESTINIAN TERRITORY, OCCUPIED => Palestine

United States currency maps to USN rather than USD

This may be a bit of a nitpick but, according to my understand, the United States has two currency codes associated with it: US dollar (USD) and US dollar, next day (USN). Why is it that calling countries.UnitedStatesOfAmerica.Info().Currency.Alpha() returns USN rather than USD when USD would be the more idiomatic usage? My use case for this code-base is primarily getting the 2-character country code and currency combinations associated with each for internationalization purposes but this doesn't seem fit-for-purpose. Perhaps split the US entry into two entries would fix this issue?

Note: I can get around this by taking the country code and doing countries.CurrencyCode(code) to get the proper code and if this is the intended usage when there is a collision then I would appreciate a function that does that explicitly.

`SubdivisionCode` does not implement sql.Scanner and driver.Valuer interfaces

First of all, thank you for this amazing package! You've saved me a TON of work.

One call out I have is, this package doesn't seem to implement the database/sql/driver.Valuer and database/sql/driver.Valuer interfaces for SubdivisionCode.

How I arrived at this conclusion:
I have an API that takes in POST requests from the client, marshals it into a Go struct, then uses Gorm to store that struct model in a Postgres DB.
The struct has a field of type countries.SubdivisionCode, and the package is able to correctly unmarshal it into the struct as a string (i.e. "US-MA" --> "Massachusetts"). It also correctly inserts it into the DB as "Massachusetts." However, when I select that record from the DB and unmarshal it into a Go struct, the subdivision code field reads as "Unknown".

✅ POST request:
image

✅ Unmarshal the Request Body with Fiber into a Struct:
image

✅ Insert Into the DB:
image

❌ Select that Record from DB: Now the field shows up as Unknown.
image

On a related note, what function is causing "US-MA" to be read in as "Massachusetts" and when is that function called? Is there a way to insert it into the DB as a "US-MA"?

EDIT:
Using fmt.Printf("%+v") printed the field as "Massachusetts" (I'm guessing the package uses the String() method to do so), but when I just use fmt.Printf("%#v"), it outputs as "US-MA". Still, how is it getting inserted into the DB as "Massachusetts" when it doesn't have an explicit driver.Valuer function?

[DepShield] (CVSS 5.9) Vulnerability due to usage of golang.org/x:crypto:0.0.0-20190325154230-a5d413f7728c

Vulnerabilities

DepShield reports that this application's usage of golang.org/x:crypto:0.0.0-20190325154230-a5d413f7728c results in the following vulnerability(s):


Occurrences

golang.org/x:crypto:0.0.0-20190325154230-a5d413f7728c is a transitive dependency introduced by the following direct dependency(s):

github.com/jinzhu:gorm:1.9.12
        └─ github.com/denisenkom:go-mssqldb:0.0.0-20191124224453-732737034ffd
              └─ golang.org/x:crypto:0.0.0-20190325154230-a5d413f7728c

This is an automated GitHub Issue created by Sonatype DepShield. Details on managing GitHub Apps, including DepShield, are available for personal and organization accounts. Please submit questions or feedback about DepShield to the Sonatype DepShield Community.

Two times GB

Hi,

It seems that countries.AllInfo() returns GB two times.

list := countries.AllInfo()

for i, c := range list {
     fmt.Println(i, c.Alpha2)
}

Result

38 GB
...
230 GB

Change in module name leads to inaccessible releases.

How shell I reference the latest releases from external project?

In this repo the module name was changed ea14952 but the other repository https://github.com/royshahaf/countries last commit is from February and there is no way to reference the recent changes any way.

in go.mod

require (
	github.com/biter777/countries v1.3.4 <- This is the last working version
	github.com/royshahaf/countries v1.5.1 <- This repo has only github.com/royshahaf/countries v1.3.7

Now Go can't find the right module and the right repository.

go: github.com/biter777/[email protected]: parsing go.mod:
        module declares its path as: github.com/royshahaf/countries
                but was required as: github.com/biter777/countries

The two only working version now are

  • github.com/biter777/countries v1.3.4
  • github.com/royshahaf/countries v1.3.7

Either fix the module names or please update the repository so the v1.5.x can be referenced from externally.

Fix Brazil currency code

I like to use this lib, soo when I started to test for Brazil, I got a problem because the lib just accept the code 76 for Brazil currency. But as we can see at https://pt.wikipedia.org/wiki/ISO_4217, the code 76 is for a very old Brazil currency named as Cruzeiro that is no longer valid since 30 years ago. The correct Brazil code is 986 for currency named as Real.

I created a PR for this fix, I would like if the maintainer could review :)
#39

Czech Republic or Czechia?

Thanks for your work on this!

We're noticing that countries.ByName("CZE") is returning Czech Republic here. The general pattern seem to be that we return the name as opposed to official_name from here in which case it seems like it should be Czechia, unless I'm missing something. Happy to submit a pr to resolve if this is not intentional.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.