Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Onion Wrapper
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
briar
Onion Wrapper
Commits
4ac50d01
Verified
Commit
4ac50d01
authored
1 year ago
by
Torsten Grote
Browse files
Options
Downloads
Patches
Plain Diff
Add getCountryDisplayName() method to LocationUtils
parent
487af945
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!6
Add getCountryDisplayName() method to LocationUtils
Pipeline
#14561
passed
1 year ago
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
onionwrapper-core/src/main/java/org/briarproject/onionwrapper/LocationUtils.java
+18
-0
18 additions, 0 deletions
...ain/java/org/briarproject/onionwrapper/LocationUtils.java
with
18 additions
and
0 deletions
onionwrapper-core/src/main/java/org/briarproject/onionwrapper/LocationUtils.java
+
18
−
0
View file @
4ac50d01
...
...
@@ -2,6 +2,8 @@ package org.briarproject.onionwrapper;
import
org.briarproject.nullsafety.NotNullByDefault
;
import
java.util.Locale
;
@NotNullByDefault
public
interface
LocationUtils
{
...
...
@@ -13,4 +15,20 @@ public interface LocationUtils {
* https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2">ISO 3166-1 alpha 2</a>.
*/
String
getCurrentCountry
();
/**
* Returns the name of the country for display in the UI
* or the isoCode if none could be found.
*
* @param isoCode The result from {@link #getCurrentCountry()}.
*/
static
String
getCountryDisplayName
(
String
isoCode
)
{
for
(
Locale
locale
:
Locale
.
getAvailableLocales
())
{
if
(
locale
.
getCountry
().
equalsIgnoreCase
(
isoCode
))
{
return
locale
.
getDisplayCountry
();
}
}
// Name is unknown
return
isoCode
;
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment