Skip to content

Commit f9431f2

Browse files
ADFA-3364: Move unreadable-classpath-jar flashError string to strings.xml
Replace the hardcoded English message in ProjectManagerImpl.reportUnreadableClasspathJars with localizable resources (msg_unreadable_classpath_jars + _overflow), resolved via BaseApplication.baseInstance. Addresses review feedback from Daniel-ADFA.
1 parent 6c0c0fc commit f9431f2

2 files changed

Lines changed: 15 additions & 6 deletions

File tree

‎resources/src/main/res/values/strings.xml‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -613,6 +613,10 @@
613613
<string name="title_reload_color_schemes">Reload color schemes</string>
614614
<string name="msg_dir_picker_failed">Failed to start directory picker : %1$s</string>
615615
<string name="msg_tooling_server_unavailable">Tooling API server is unavailable. Check build output and IDE logs for errors.</string>
616+
<!-- Shown when one or more dependency JARs were corrupt/unreadable during classpath indexing. %1$s is a comma-separated list of dependency names (may end with an overflow clause). -->
617+
<string name="msg_unreadable_classpath_jars">Some dependencies couldn\'t be read and were skipped, so code completion may be incomplete: %1$s. Sync the project to re-download dependencies.</string>
618+
<!-- Appended to the dependency list when more than three dependencies were skipped. %1$s is the first listed dependency names; %2$d is the count of additional ones. -->
619+
<string name="msg_unreadable_classpath_jars_overflow">%1$s and %2$d more</string>
616620
<string name="idepref_deleteEmptyLines_title">Delete empty lines on backspace</string>
617621
<string name="idepref_deleteEmptyLines_summary">If a line contains no visible text characters, pressing backspace removes the entire line.</string>
618622
<string name="idepref_deleteTabs_title">Smart backspace indent</string>

‎subprojects/projects/src/main/java/com/itsaky/androidide/projects/ProjectManagerImpl.kt‎

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ package com.itsaky.androidide.projects
2020
import androidx.annotation.RestrictTo
2121
import com.google.auto.service.AutoService
2222
import com.google.common.collect.ImmutableList
23+
import com.itsaky.androidide.app.BaseApplication
2324
import com.itsaky.androidide.eventbus.events.EventReceiver
2425
import com.itsaky.androidide.eventbus.events.editor.DocumentSaveEvent
2526
import com.itsaky.androidide.eventbus.events.file.FileCreationEvent
@@ -197,13 +198,17 @@ class ProjectManagerImpl :
197198
return
198199
}
199200

200-
val shown = names.take(3).joinToString(", ")
201-
val more = if (names.size > 3) " and ${names.size - 3} more" else ""
202201
log.warn("Skipped {} unreadable classpath JAR(s) during indexing: {}", names.size, names)
203-
flashError(
204-
"Some dependencies couldn't be read and were skipped, so code completion may be " +
205-
"incomplete: $shown$more. Sync the project to re-download dependencies.",
206-
)
202+
203+
val context = BaseApplication.baseInstance
204+
val shown = names.take(3).joinToString(", ")
205+
val list =
206+
if (names.size > 3) {
207+
context.getString(R.string.msg_unreadable_classpath_jars_overflow, shown, names.size - 3)
208+
} else {
209+
shown
210+
}
211+
flashError(context.getString(R.string.msg_unreadable_classpath_jars, list))
207212
}
208213

209214
override fun getAndroidModules(): List<AndroidModule> {

0 commit comments

Comments
 (0)