(@NonNull Locale locale, int index, Context context)
| 46 | } |
| 47 | |
| 48 | private static String getWord(@NonNull Locale locale, int index, Context context) { |
| 49 | String lang = locale.getLanguage(); |
| 50 | if ("zh".equals(lang) && "CN".equals(locale.getCountry())) |
| 51 | lang = "zh_cn"; |
| 52 | try (InputStream is = context.getAssets().open("bip39/" + lang + ".txt")) { |
| 53 | return getWord(is, index); |
| 54 | } catch (Throwable ex) { |
| 55 | Log.w(ex); |
| 56 | try (InputStream is = context.getAssets().open("bip39/en.txt")) { |
| 57 | return getWord(is, index); |
| 58 | } catch (Throwable exex) { |
| 59 | Log.e(exex); |
| 60 | return getRandomWord(5); |
| 61 | } |
| 62 | } |
| 63 | } |
| 64 | |
| 65 | private static String getWord(InputStream is, int index) throws IOException { |
| 66 | String word = null; |
no test coverage detected