Crowdin use two letter codes (#1131)

This commit is contained in:
LoveSy 2021-09-18 15:31:52 +08:00 committed by GitHub
parent 8e9950a111
commit 77eddd7779
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 4 deletions

View File

@ -67,6 +67,7 @@ import org.lsposed.manager.ui.widget.LinkifyTextView;
import org.lsposed.manager.util.NavUtil;
import org.lsposed.manager.util.chrome.CustomTabsURLSpan;
import java.io.ByteArrayInputStream;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;
@ -182,15 +183,13 @@ public class RepoItemFragment extends BaseFragment implements RepoLoader.Listene
var contentTypes = reply.header("content-type", "image/*;charset=utf-8").split(";\\s*");
var mimeType = contentTypes.length > 0 ? contentTypes[0] : "image/*";
var charset = contentTypes.length > 1 ? contentTypes[1].split("=\\s*")[1] : "utf-8";
Log.e(App.TAG, "type " + mimeType);
Log.e(App.TAG, "charset " + charset);
return new WebResourceResponse(
mimeType,
charset,
reply.body().byteStream()
);
} catch (Throwable e) {
return null;
return new WebResourceResponse("text/html", "utf-8", new ByteArrayInputStream(Log.getStackTraceString(e).getBytes(StandardCharsets.UTF_8)));
}
}
});

View File

@ -18,7 +18,7 @@
files: [
{
"source" : "/app/src/main/res/values/strings.xml",
"translation" : "/app/src/main/res/values-%android_code%/%original_file_name%",
"translation" : "/app/src/main/res/values-%two_letters_code%/%original_file_name%",
"type": "android",
"dest": "/app/strings.xml",
"skip_untranslated_strings": true