-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #25 from axenuli/master
More explicit locale choices on settings. Closes #24
- Loading branch information
Showing
3 changed files
with
118 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package org.inaturalist.android; | ||
|
||
import java.util.Locale; | ||
|
||
/** | ||
* Created by ulrikeaxen on 1/4/15. | ||
*/ | ||
public class LocaleHelper { | ||
|
||
private static final String DefaultLocale = "en"; | ||
|
||
// add locale codes here when they are complete in values | ||
// Todo: what is es-Res? | ||
public static final String[] SupportedLocales = new String[] { | ||
"en", | ||
"ca", | ||
"es", | ||
"eu", | ||
"gl" | ||
}; | ||
|
||
|
||
public static String getDefaultLocale() | ||
{ | ||
String languageCode = Locale.getDefault().getLanguage(); | ||
for (int i = 0; i < SupportedLocales.length; i++) | ||
if (languageCode.equalsIgnoreCase(SupportedLocales[i])) | ||
return SupportedLocales[i]; | ||
return DefaultLocale; | ||
} | ||
} |