Skip to content

Commit a4d243d

Browse files
committed
Use the descriptive part of lang entries (if present) to display
repo settings keys, trans bool values - add local function "plugin_lang_get_defaulted" for the lookup
1 parent e922af8 commit a4d243d

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

Source/pages/repo_manage_page.php

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
$f_repo_id = gpc_get_int( 'id' );
99

1010
$t_repo = SourceRepo::load( $f_repo_id );
11+
$t_vcs = SourceVCS::repo( $t_repo );
1112
$t_type = SourceType($t_repo->type);
1213

1314
$t_mappings = $t_repo->load_mappings();
@@ -74,6 +75,22 @@ function convert_to_key_value( $p_array ) {
7475
return $t_result;
7576
}
7677

78+
function plugin_lang_get_defaulted( $p_name, $p_basename, $p_default = null, $p_lang = null ) {
79+
if( !is_null( $p_basename ) ) {
80+
plugin_push_current( $p_basename );
81+
}
82+
83+
$t_basename = plugin_get_current();
84+
$t_name = 'plugin_' . $t_basename . '_' . $p_name;
85+
$t_string = lang_get_defaulted( $t_name, $p_default, $p_lang );
86+
87+
if( !is_null( $p_basename ) ) {
88+
plugin_pop_current();
89+
}
90+
return $t_string;
91+
}
92+
93+
7794
layout_page_header( plugin_lang_get( 'title' ) );
7895
layout_page_begin();
7996
?>
@@ -119,10 +136,12 @@ function convert_to_key_value( $p_array ) {
119136
<?php
120137
$t_formatted_array = convert_to_key_value( $t_repo->info );
121138
foreach( $t_formatted_array as $t_key => $t_value ) {
139+
# Extract the descriptive part of the $t_key lang entry
140+
list( $t_description ) = explode( "<br", plugin_lang_get_defaulted( $t_key, $t_vcs->basename, $t_key ) );
122141
?>
123142
<tr>
124-
<td class="category"><?php echo $t_key ?></td>
125-
<td><?php echo $t_value ?></td>
143+
<td class="category"><?php echo $t_description ?></td>
144+
<td><?php echo is_bool( $t_value ) ? trans_bool( $t_value ) : $t_value ?></td>
126145
</tr>
127146
<?php } ?>
128147
</table>

0 commit comments

Comments
 (0)