Java: how to determine the real, unbearable user language and user country?

For our Java application, we are considering the possibility of tightening our licensing conditions and the corresponding code for certain countries for which we are experiencing a serious violation of the license. Therefore, we want to know the real language of the user and the country of the user. I know that you can query properties of the system user.languageand user.country, but they can be easily faked with a Java application startup, using, for example -Duser.language=en. Is there a way to determine the original, immutable values ​​for these properties? Or is there another API that gives us real settings?

Note:

  • the solution should only require a little computational effort and no internet connection

  • we are not looking for a completely safe solution, but it should also not be too easy to fake (for example, with system properties).

+4
source share
1 answer

Do not even try. You are trying to solve a legal issue at a technical level. I once used a Linux machine, where different users had different declared languages ​​and time zones, and still have a virtual machine using the "C" language and the UTC time zone.

According to my experience, such controls can annoy well-intentioned users who use a non-standard configuration, but cannot prevent someone from knowingly giving the wrong information.

So my advice is:

  • use the system property to get the declared country.
  • ask the user to confirm or change it.

.

+7

Source: https://habr.com/ru/post/1693976/


All Articles