11package com.aicode.feature.git.presentation.component
22
3+ import androidx.annotation.StringRes
34import androidx.activity.compose.BackHandler
45import androidx.compose.foundation.Canvas
56import androidx.compose.foundation.ExperimentalFoundationApi
@@ -835,7 +836,7 @@ private fun BranchesTab(
835836 if (localBranches.isNotEmpty()) {
836837 item {
837838 RefSectionHeader (
838- title = " Local (${localBranches.size} )" ,
839+ title = " ${stringResource( R .string.common_local)} (${localBranches.size} )" ,
839840 isExpanded = isExpanded(" local" ),
840841 onToggle = { expanded[" local" ] = ! isExpanded(" local" ) },
841842 onAdd = { showCreateDialog = true }
@@ -858,7 +859,7 @@ private fun BranchesTab(
858859 if (remoteBranches.isNotEmpty()) {
859860 item {
860861 RefSectionHeader (
861- title = " Remote (${remoteBranches.size} )" ,
862+ title = " ${stringResource( R .string.git_remote)} (${remoteBranches.size} )" ,
862863 isExpanded = isExpanded(" remote" ),
863864 onToggle = { expanded[" remote" ] = ! isExpanded(" remote" ) }
864865 )
@@ -880,7 +881,7 @@ private fun BranchesTab(
880881 if (tags.isNotEmpty()) {
881882 item {
882883 RefSectionHeader (
883- title = " Tags (${tags.size} )" ,
884+ title = " ${stringResource( R .string.git_tags)} (${tags.size} )" ,
884885 isExpanded = isExpanded(" tags" ),
885886 onToggle = { expanded[" tags" ] = ! isExpanded(" tags" ) },
886887 onAdd = { showCreateTagDialog = true }
@@ -1007,14 +1008,14 @@ private fun RefSectionHeader(
10071008 * 分支/标签行可执行的操作项,用于长按弹出的操作菜单。
10081009 */
10091010private sealed class RefAction (
1010- val label : String ,
1011+ @StringRes val labelRes : Int ,
10111012 val icon : ImageVector ,
10121013 val isDestructive : Boolean ,
10131014 val onClick : () -> Unit
10141015) {
1015- class Switch (onClick : () -> Unit ) : RefAction(" Switch " , FeatherIcons .GitCommit , false , onClick)
1016- class Rename (onClick : () -> Unit ) : RefAction(" Rename " , FeatherIcons .Edit2 , false , onClick)
1017- class Delete (onClick : () -> Unit ) : RefAction(" Delete " , FeatherIcons .Trash2 , true , onClick)
1016+ class Switch (onClick : () -> Unit ) : RefAction(R .string.common_switch , FeatherIcons .GitCommit , false , onClick)
1017+ class Rename (onClick : () -> Unit ) : RefAction(R .string.common_rename , FeatherIcons .Edit2 , false , onClick)
1018+ class Delete (onClick : () -> Unit ) : RefAction(R .string.common_delete , FeatherIcons .Trash2 , true , onClick)
10181019}
10191020
10201021@Composable
@@ -1144,7 +1145,7 @@ private fun RefActionSheet(
11441145 )
11451146 Spacer (Modifier .width(Spacing .lg))
11461147 Text (
1147- text = action.label ,
1148+ text = stringResource( action.labelRes) ,
11481149 style = MaterialTheme .typography.bodyLarge,
11491150 color = tint
11501151 )
0 commit comments