DeepL: added flags

pull/198/head
M66B 3 years ago
parent e2c6a3673b
commit 6068c58f4e

@ -30,3 +30,4 @@ FairEmail uses:
* [Compact Encoding Detection](https://github.com/google/compact_enc_det). Copyright 2016 Google Inc. [Apache License 2.0](https://github.com/google/compact_enc_det/blob/master/LICENSE).
* [Compact Language Detector v3](https://github.com/google/cld3). Copyright 2016 Google Inc. All rights reserved. [Apache License 2.0](https://github.com/google/cld3/blob/master/LICENSE).
* [POI-HMEF](https://poi.apache.org/components/hmef/index.html). Copyright © 2001-2020 The Apache Software Foundation. [Apache Software License v2](https://poi.apache.org/devel/guidelines.html#The+Licensing).
* [GoSquared's Flag Icon Set](https://github.com/gosquared/flags). Copyright (c) 2017 Go Squared Ltd. [MIT License](https://github.com/gosquared/flags/blob/master/LICENSE.txt).

@ -30,3 +30,4 @@ FairEmail uses:
* [Compact Encoding Detection](https://github.com/google/compact_enc_det). Copyright 2016 Google Inc. [Apache License 2.0](https://github.com/google/compact_enc_det/blob/master/LICENSE).
* [Compact Language Detector v3](https://github.com/google/cld3). Copyright 2016 Google Inc. All rights reserved. [Apache License 2.0](https://github.com/google/cld3/blob/master/LICENSE).
* [POI-HMEF](https://poi.apache.org/components/hmef/index.html). Copyright © 2001-2020 The Apache Software Foundation. [Apache Software License v2](https://poi.apache.org/devel/guidelines.html#The+Licensing).
* [GoSquared's Flag Icon Set](https://github.com/gosquared/flags). Copyright (c) 2017 Go Squared Ltd. [MIT License](https://github.com/gosquared/flags/blob/master/LICENSE.txt).

@ -1448,11 +1448,18 @@ public class FragmentCompose extends FragmentBase {
String json = Helper.readStream(is);
JSONArray jarray = new JSONArray(json);
String pkg = getContext().getPackageName();
for (int i = 0; i < jarray.length(); i++) {
JSONObject jlanguage = jarray.getJSONObject(i);
String name = jlanguage.getString("name");
String target = jlanguage.getString("language");
SubMenu smenu = menu.findItem(R.id.menu_translate).getSubMenu();
smenu.add(R.id.group_translate, i + 1, i + 1, jlanguage.getString("name"))
.setIntent(new Intent().putExtra("target", jlanguage.getString("language")));
MenuItem item = smenu.add(R.id.group_translate, i + 1, i + 1, name)
.setIntent(new Intent().putExtra("target", target));
String resname = "language_" + target.toLowerCase().replace('-', '_');
int resid = getResources().getIdentifier(resname, "drawable", pkg);
if (resid > 0)
item.setIcon(resid);
}
} catch (Throwable ex) {
Log.e(ex);

Binary file not shown.

After

Width:  |  Height:  |  Size: 111 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 626 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 144 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 312 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 110 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 110 B

Loading…
Cancel
Save