Coder Social home page Coder Social logo

nv-i18n's People

Contributors

cneijenhuis avatar dependabot[bot] avatar gundalf72 avatar harryblam avatar mfmetro avatar mjones1989 avatar oniboni avatar pjfanning avatar takahikokawasaki avatar xzer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nv-i18n's Issues

Change Norwegian LocaleCode from no_NO to nb_NO

Hello!

At the moment there are three languages in Norway - Bokmål, Nynorsk and Samisk.
LocaleCode in 1.7 version for Norwegian Bokmål language is no_NO, nn_NO for nynorsk (this is correct) and doesn't exist for samisk.
At the moment the correct locale for Bokmål is nb_NO, so please change from no_NO to nb_NO if possible.
Proofs you can find here:
https://bugzilla.redhat.com/show_bug.cgi?id=532487
and here (Norwegian, but idea is clear from table)
http://i18n.skolelinux.no/localekoder.txt

UNDEFINED enum value should be removed

The concept of an unknown CurrencyCode or CountryCode is much better represented as Optional.empty() or null.

The documentation would benefit from a mention that these values exist and the motivation for adding them. It will be a surprise to most users of these enumerations that the UNDEFINED value exists.

Correct obsolete currency codes

Correct obsolete currency codes

  1. Currency code for Belarusian ruble (BYR) is now obsolete. New one (BYN) should be used instead.
  2. Currency code for Lithuanian lit (LTL) is now obsolete. A code for Euro should be used instead.
  3. Lithuania's country code should be added to array of countries which use Euro.

add a boolean switch for lower case findByName

Two new methods perhaps :


public static List<CountryCode> findByName(String regex, boolean lc) {
..


public static List<CountryCode> findByName(Pattern pattern, boolean lc)
...

Then
https://github.com/TakahikoKawasaki/nv-i18n/blob/master/src/main/java/com/neovisionaries/i18n/CountryCode.java#L2960
from

if (pattern.matcher(entry.getName()).matches())

To something like:

if (lc && pattern.matcher(entry.getName().toLowerCase()).matches()||!lc  && pattern.matcher(entry.getName()).matches() )

Non standard locales in the wild (es_LA)

Some developers have had the brilliant idea of using non-standard and conflicting locale codes in their apps. The problem is that, in the case of es_LA (according to ISO "Spanish for Laos", but actually used for "Spanish for Latin America").

I wouldn't file a bug here if it weren't because this is now quite spread and common practice (you'll get that from Facebook's API or in free software localization files).

On the one hand, special handling for this case could be added ("LA" is not Laos if preceded by "es"). On the other, "Latin America" is not a country, and as such it lacks 2-digit ISO code. But it does have a 3-digit UN M.49 supranational code.

I'm not sure what would be an appropiate way of handling this in nv-i18n. At the moment, I'm just getting around it by replacing "es_LA" by just "es" before feeding it to nv-18n.

Make methods public

Could you please make methods such as getByAlpha2Code, getByAlpha3Code etc. public?

e.g. If a value needs to be a valid ISO 3166-1 alpha-2 but not alpha-3 this would make it easier to check.
Currently, the value needs to be checked if the length has the appropriate length prior to calling getByCode.

Thanks

minor change

This might sound pedantic,

but it is advised to change

public static CurrencyCode getByCode(String code, boolean caseSensitive)
//to
public static CurrencyCode getByCodeCaseSensitive(String code)
//or event better
public static CurrencyCode getByCodeIgnoreCase(String code)
public static CurrencyCode getByCode(String code) // exact. Doesn't ignore case

Why is this approach any better you ask?

  1. You see from the method name what it does and can conclude to the other as they are only two possibilities
  2. Now boolean caseSensitive is always true otherwise there would be no need for getByCode
  3. Now it is ambiguous as there are 3 ways of doing something(getByCode and getByCode(true,false)) where only two are really distinct and needed.
  4. Now you have to look into code to see what getByCode(String) does as it not 100% clear because it might be a third case.
  5. It is compliant with other util libs such as apache commons or guava.
  6. It is clean code

Feature request: continent codes

It would be useful if one of the following were added:

  • A (very small) enum for ContinentCode which lists all of the countries on that continent, or
  • Each CountryCode enum had a ContinentCode field

If this is particularly burdensome I'm willing to put in the initial work to create the mapping – just let me know which implementation you prefer.

Add OSGi headers to the jar's manifest

I want to use this library in an OSGi container, but it needs to contain some headers in the META-INF/manifest.mf file in order to do so.

Many important platforms are OSGi-based, such as Eclipse, Apache ServiceMix, Sling, and Glassfish.

Fortunately it is pretty easy to add this to your maven build. I'll work on a pull request.

Add old currency RUR

Could you add the old currency of the Russian Federation RUR (code:810, minorUtit: 2).
Some of the services return 'RUR', which causes NPE in our code

Feature request: IATA airport code

Hi,

My request could be a little bit out of scope but it will be nice to add mapping between IATA airport code and related country code. I suppose it could help to extend this liberally power. What do you think about it?

Thanks.

Send Binery Proirity

is there any for set priority in sendBinery()?

for example i have a byte array with 10 Mb size, and i used from sendBinery(). Before this byte array is really sent and onFrameSent() called , i want to send another byte array with just 1 byte , how can i send second array with lower size before send first byte array, and do not wait to send a bigger byte array?

Build failure: "signing failed: secret key not available"

Could digitally signing the jarfile be optional?

Build of master branch fails due to signing failure because secret key "E3F58E5C" is not available:

derek@derek-lubuntu:~/Projects/nv-i18n.takahiko$ mvn clean install
[INFO] Scanning for projects...
[WARNING] 
[WARNING] Some problems were encountered while building the effective model for com.neovisionaries:nv-i18n:bundle:1.23-SNAPSHOT
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-site-plugin is missing. @ line 73, column 29
[WARNING] 
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING] 
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING] 
[INFO] Inspecting build with total of 1 modules...
[INFO] Installing Nexus Staging features:
[INFO]   ... total of 1 executions of maven-deploy-plugin replaced with nexus-staging-maven-plugin
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building Neo Visionaries Internationalization Package 1.23-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ nv-i18n ---
[INFO] 
[INFO] --- maven-resources-plugin:3.0.2:resources (default-resources) @ nv-i18n ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /home/derek/Projects/nv-i18n.takahiko/src/main/resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.2:compile (default-compile) @ nv-i18n ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 7 source files to /home/derek/Projects/nv-i18n.takahiko/target/classes
[INFO] 
[INFO] --- maven-resources-plugin:3.0.2:testResources (default-testResources) @ nv-i18n ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /home/derek/Projects/nv-i18n.takahiko/src/test/resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.2:testCompile (default-testCompile) @ nv-i18n ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 6 source files to /home/derek/Projects/nv-i18n.takahiko/target/test-classes
[INFO] 
[INFO] --- maven-surefire-plugin:2.20:test (default-test) @ nv-i18n ---
[INFO] 
[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
[INFO] Running com.neovisionaries.i18n.ScriptCodeTest
[INFO] Tests run: 52, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.193 s - in com.neovisionaries.i18n.ScriptCodeTest
[INFO] Running com.neovisionaries.i18n.LanguageCodeTest
[INFO] Tests run: 121, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.276 s - in com.neovisionaries.i18n.LanguageCodeTest
[INFO] Running com.neovisionaries.i18n.CountryCodeTest
[INFO] Tests run: 41, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.052 s - in com.neovisionaries.i18n.CountryCodeTest
[INFO] Running com.neovisionaries.i18n.LocaleCodeTest
[INFO] Tests run: 45, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.044 s - in com.neovisionaries.i18n.LocaleCodeTest
[INFO] Running com.neovisionaries.i18n.CurrencyCodeTest
[INFO] Tests run: 17, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.048 s - in com.neovisionaries.i18n.CurrencyCodeTest
[INFO] Running com.neovisionaries.i18n.LanguageAlpha3CodeTest
[INFO] Tests run: 183, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.093 s - in com.neovisionaries.i18n.LanguageAlpha3CodeTest
[INFO] 
[INFO] Results:
[INFO] 
[INFO] Tests run: 459, Failures: 0, Errors: 0, Skipped: 0
[INFO] 
[INFO] 
[INFO] --- maven-bundle-plugin:2.5.3:bundle (default-bundle) @ nv-i18n ---
[INFO] 
[INFO] --- maven-source-plugin:2.3:jar-no-fork (attach-sources) @ nv-i18n ---
[INFO] Building jar: /home/derek/Projects/nv-i18n.takahiko/target/nv-i18n-1.23-SNAPSHOT-sources.jar
[INFO] 
[INFO] --- maven-javadoc-plugin:2.10.1:jar (attach-javadocs) @ nv-i18n ---
[INFO] 
Loading source files for package com.neovisionaries.i18n...
Constructing Javadoc information...
Standard Doclet version 1.8.0_131
Building tree for all the packages and classes...
Generating /home/derek/Projects/nv-i18n.takahiko/target/apidocs/com/neovisionaries/i18n/CountryCode.html...
Generating /home/derek/Projects/nv-i18n.takahiko/target/apidocs/com/neovisionaries/i18n/CountryCode.Assignment.html...
Generating /home/derek/Projects/nv-i18n.takahiko/target/apidocs/com/neovisionaries/i18n/CurrencyCode.html...
Generating /home/derek/Projects/nv-i18n.takahiko/target/apidocs/com/neovisionaries/i18n/LanguageAlpha3Code.html...
Generating /home/derek/Projects/nv-i18n.takahiko/target/apidocs/com/neovisionaries/i18n/LanguageAlpha3Code.Usage.html...
Generating /home/derek/Projects/nv-i18n.takahiko/target/apidocs/com/neovisionaries/i18n/LanguageCode.html...
Generating /home/derek/Projects/nv-i18n.takahiko/target/apidocs/com/neovisionaries/i18n/LocaleCode.html...
Generating /home/derek/Projects/nv-i18n.takahiko/target/apidocs/com/neovisionaries/i18n/ScriptCode.html...
Generating /home/derek/Projects/nv-i18n.takahiko/target/apidocs/com/neovisionaries/i18n/package-frame.html...
Generating /home/derek/Projects/nv-i18n.takahiko/target/apidocs/com/neovisionaries/i18n/package-summary.html...
Generating /home/derek/Projects/nv-i18n.takahiko/target/apidocs/com/neovisionaries/i18n/package-tree.html...
Generating /home/derek/Projects/nv-i18n.takahiko/target/apidocs/constant-values.html...
Generating /home/derek/Projects/nv-i18n.takahiko/target/apidocs/com/neovisionaries/i18n/class-use/LocaleCode.html...
Generating /home/derek/Projects/nv-i18n.takahiko/target/apidocs/com/neovisionaries/i18n/class-use/ScriptCode.html...
Generating /home/derek/Projects/nv-i18n.takahiko/target/apidocs/com/neovisionaries/i18n/class-use/LanguageCode.html...
Generating /home/derek/Projects/nv-i18n.takahiko/target/apidocs/com/neovisionaries/i18n/class-use/LanguageAlpha3Code.html...
Generating /home/derek/Projects/nv-i18n.takahiko/target/apidocs/com/neovisionaries/i18n/class-use/LanguageAlpha3Code.Usage.html...
Generating /home/derek/Projects/nv-i18n.takahiko/target/apidocs/com/neovisionaries/i18n/class-use/CurrencyCode.html...
Generating /home/derek/Projects/nv-i18n.takahiko/target/apidocs/com/neovisionaries/i18n/class-use/CountryCode.html...
Generating /home/derek/Projects/nv-i18n.takahiko/target/apidocs/com/neovisionaries/i18n/class-use/CountryCode.Assignment.html...
Generating /home/derek/Projects/nv-i18n.takahiko/target/apidocs/com/neovisionaries/i18n/package-use.html...
Building index for all the packages and classes...
Generating /home/derek/Projects/nv-i18n.takahiko/target/apidocs/overview-tree.html...
Generating /home/derek/Projects/nv-i18n.takahiko/target/apidocs/index-all.html...
Generating /home/derek/Projects/nv-i18n.takahiko/target/apidocs/deprecated-list.html...
Building index for all classes...
Generating /home/derek/Projects/nv-i18n.takahiko/target/apidocs/allclasses-frame.html...
Generating /home/derek/Projects/nv-i18n.takahiko/target/apidocs/allclasses-noframe.html...
Generating /home/derek/Projects/nv-i18n.takahiko/target/apidocs/index.html...
Generating /home/derek/Projects/nv-i18n.takahiko/target/apidocs/help-doc.html...
[INFO] Building jar: /home/derek/Projects/nv-i18n.takahiko/target/nv-i18n-1.23-SNAPSHOT-javadoc.jar
[INFO] 
[INFO] --- maven-gpg-plugin:1.5:sign (sign-artifacts) @ nv-i18n ---
gpg: skipped "E3F58E5C": secret key not available
gpg: signing failed: secret key not available
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 12.933 s
[INFO] Finished at: 2017-08-17T16:26:13-04:00
[INFO] Final Memory: 22M/90M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-gpg-plugin:1.5:sign (sign-artifacts) on project nv-i18n: Exit code: 2 -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

Improvement: Currency name in locales

I think, be cool, if in CurrencyCode I can get displayName for currency on diffirent languages. I can give you Currencies names in Russian language and you can include properties-file in lib. My email: [email protected]. Send me and I give you properties-file for Russian language

CountryCodes.EU.getCurrency() returns null on newer versions of Java

The getCurrency() method in com.neovisionaries.i18n.CountryCode fails for CountryCode.EU. The currency cannot be resolved for the locale Locale("", "EU") and an exception gets thrown by the standard library.

import java.util.*;

class Main {

    public static void main(String[] args) {
        var l = new Locale("", "EU");
        var c = Currency.getInstance(l);

        println(c);
    }

}
Exception in thread "main" java.lang.IllegalArgumentException
        at java.base/java.util.Currency.getInstance(Currency.java:410)
        at Main.main(currency.java:7)

Due to the exception handling, the call CurrencyCode.EU.getCurrency() results with null.

New Feature: Phone codes

What do you think about PhoneCode class? Maybe add to lib phone code and relation with countries?

add assignment field to CurrencyCode

The assignment field on CountryCode is useful for working out if country codes are no longer used (eg just use the OFFICIALLY_ASSIGNED codes).

CurrencyCode has some javadoc @deprecated markers but I think it would be better to have some explicit flag that can be checked in code.

No Kazakh locale codes

There are no entries in LocaleCode for kazakhstan at all. Would you mind adding kk_KZ and ru_KZ?

Feature request: Continents

Hello!

I really like your library, but i'm lacking consistent Continent support. What do you think about including such feature? I'm willing to implement it.

Add Automatic-Module-Name to the Manifest

Hi! Correct me if I'm wrong but now it's not possible to reliably use the library in the modularized application. Because if I add the jar to the module path it becomes an automatic module and its name is derived from the jar name because there is no Automatic-Module-Name entry in the Manifest and that's something pretty fragile in case you rename the jar. So could you please add this entry?

Why is CountryCode.TW "Taiwan, Province of China"?

The explicit label "Province of China" seems unnecessarily political. If I print the country name text as-is in my app I'm at risk of making it look like my app has a political opinion.

It's mildly annoying having to filter this bit of text out. How about we change the text to simply "Taiwan"?

Improvement: Country name in locales

Now for get display country name i must wite something like this:

String countryName = new Locale("", countryCode).getDisplayCountry(systemConfig.getLocale());

In JDK class Locale there is translates country names for some languages (English, Russian), but not all.

I use CountryCode, but for display country name i must use class Locale.

Language <-> Country mapping

Hi, it would be nice to have some "Language <-> Country" mapping.
Optimally both would be a collection, "Language is spoken in this list of countries" and "Country has these languages used" and for each also one main mapping, either separately or by convention as first entry in the returned list. This would be like "if you want to show a flag for this language, then use the flag of country X" and "if you want a default language decision for country x, use this language".

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.