1919import com .reandroid .arsc .chunk .TableBlock ;
2020import com .reandroid .arsc .model .ResourceEntry ;
2121import com .reandroid .arsc .value .Entry ;
22+ import com .reandroid .arsc .value .ResConfig ;
2223import com .reandroid .arsc .value .ResValue ;
2324import com .reandroid .arsc .value .ValueType ;
2425import com .reandroid .dex .smali .SmaliWriter ;
@@ -43,7 +44,7 @@ class ResourceTableComment implements ResourceIdComment {
4344
4445 private final PackageBlock packageBlock ;
4546 private final TableBlock tableBlock ;
46- private final Locale locale ;
47+ private final ResConfig localeConfig ;
4748 private final Map <Integer , Object > mCachedComment ;
4849 private final Object mNoComment ;
4950
@@ -53,7 +54,10 @@ public ResourceTableComment(PackageBlock packageBlock, Locale locale) {
5354 if (locale == null ) {
5455 locale = new Locale ("en" );
5556 }
56- this .locale = locale ;
57+ ResConfig resConfig = new ResConfig ();
58+ resConfig .setLanguage (locale .getLanguage ());
59+ resConfig .setRegion (locale .getLanguage ());
60+ this .localeConfig = resConfig ;
5761 this .mCachedComment = new HashMap <>();
5862 this .mNoComment = new Object ();
5963 }
@@ -71,7 +75,7 @@ public void writeComment(SmaliWriter writer, int resourceId) {
7175 writer .appendComment (comment );
7276 }
7377 }
74- private String getComment (int resourceId ) {
78+ private synchronized String getComment (int resourceId ) {
7579 Integer id = resourceId ;
7680 Map <Integer , Object > map = this .mCachedComment ;
7781 Object obj = map .get (id );
@@ -104,7 +108,7 @@ private String buildComment(int resourceId) {
104108 if ("id" .equals (resourceEntry .getType ())) {
105109 return ref ;
106110 }
107- Entry entry = resourceEntry .forLocale (this .locale );
111+ Entry entry = resourceEntry .getMatchingOrAny (this .localeConfig );
108112 if (entry == null ) {
109113 return ref ;
110114 }
0 commit comments