@@ -7,6 +7,7 @@ import com.intellij.ui.components.JBLabel
77import com.intellij.util.messages.MessageBusConnection
88import com.intellij.util.ui.JBFont
99import com.intellij.util.ui.JBUI
10+ import ee.carlrobert.codegpt.CodeGPTBundle
1011import ee.carlrobert.codegpt.CodeGPTKeys
1112import ee.carlrobert.codegpt.settings.models.ModelSettings
1213import ee.carlrobert.codegpt.settings.service.*
@@ -73,6 +74,8 @@ class AgentCreditsToolbarLabel(
7374 val provider = ModelSettings .getInstance()
7475 .getServiceForFeature(FeatureType .AGENT )
7576 if (provider != ServiceType .PROXYAI ) {
77+ text = null
78+ toolTipText = null
7679 isVisible = false
7780 return @invokeLater
7881 }
@@ -89,21 +92,25 @@ class AgentCreditsToolbarLabel(
8992 (userTotal - userDetails.creditsUsed).coerceAtLeast(0 )
9093 } else null
9194 val remaining = credits?.remaining ? : userRemaining
95+ val labelPrefix = CodeGPTBundle .get(" agent.credits.label" )
96+ val remainingText = remaining?.let {
97+ CodeGPTBundle .get(" agent.credits.remainingValue" , numberFormat.format(it))
98+ } ? : " --"
9299
93- text = if (remaining != null ) {
94- " Credits: ${numberFormat.format(remaining)} left"
95- } else {
96- " Credits: --"
97- }
100+ text = " $labelPrefix : $remainingText "
98101
99102 toolTipText = buildString {
100103 append(" <html><body>" )
101- append(" <b>Credits </b><br>" )
104+ append(" <b>$labelPrefix </b><br>" )
102105 if (remaining != null ) {
103- append(" Remaining: ${numberFormat.format(remaining)} <br>" )
106+ append(
107+ CodeGPTBundle .get(" agent.credits.tooltip.remaining" , numberFormat.format(remaining))
108+ )
109+ append(" <br>" )
104110 }
105111 if (userTotal != null ) {
106- append(" Total: ${numberFormat.format(userTotal)} <br>" )
112+ append(CodeGPTBundle .get(" agent.credits.tooltip.total" , numberFormat.format(userTotal)))
113+ append(" <br>" )
107114 }
108115 append(" </body></html>" )
109116 }
0 commit comments