diff --git a/assets/css/tables.css b/assets/css/tables.css index c8114ce..7d9dfeb 100644 --- a/assets/css/tables.css +++ b/assets/css/tables.css @@ -10,6 +10,12 @@ border-radius: 4px; } +#ctl-options.ctl-tables h2.nav-tab { + padding: 5px; + white-space: pre-line; + overflow-wrap: break-word; +} + #ctl-options .form-table th { display: none; } @@ -118,6 +124,8 @@ td fieldset .ctl-table-cell label { border: 1px solid transparent; vertical-align: middle; box-sizing: border-box; + overflow: hidden; + word-break: break-all; } .ctl-table-cell input { diff --git a/src/php/Settings/Tables.php b/src/php/Settings/Tables.php index 70d2d68..6577290 100644 --- a/src/php/Settings/Tables.php +++ b/src/php/Settings/Tables.php @@ -84,42 +84,18 @@ protected function init_locales() { } $this->locales = [ - 'iso9' => [ - 'label' => __( 'ISO9 Table', 'cyr2lat' ), - ], - 'bel' => [ - 'label' => __( 'bel Table', 'cyr2lat' ), - ], - 'uk' => [ - 'label' => __( 'uk Table', 'cyr2lat' ), - ], - 'bg_BG' => [ - 'label' => __( 'bg_BG Table', 'cyr2lat' ), - ], - 'mk_MK' => [ - 'label' => __( 'mk_MK Table', 'cyr2lat' ), - ], - 'sr_RS' => [ - 'label' => __( 'sr_RS Table', 'cyr2lat' ), - ], - 'el' => [ - 'label' => __( 'el Table', 'cyr2lat' ), - ], - 'hy' => [ - 'label' => __( 'hy Table', 'cyr2lat' ), - ], - 'ka_GE' => [ - 'label' => __( 'ka_GE Table', 'cyr2lat' ), - ], - 'kk' => [ - 'label' => __( 'kk Table', 'cyr2lat' ), - ], - 'he_IL' => [ - 'label' => __( 'he_IL Table', 'cyr2lat' ), - ], - 'zh_CN' => [ - 'label' => __( 'zh_CN Table', 'cyr2lat' ), - ], + 'iso9' => __( 'Default', 'cyr2lat' ) . '
ISO9', + 'bel' => __( 'Belarusian', 'cyr2lat' ) . '
bel', + 'uk' => __( 'Ukrainian', 'cyr2lat' ) . '
uk', + 'bg_BG' => __( 'Bulgarian', 'cyr2lat' ) . '
bg_BG', + 'mk_MK' => __( 'Macedonian', 'cyr2lat' ) . '
mk_MK', + 'sr_RS' => __( 'Serbian', 'cyr2lat' ) . '
sr_RS', + 'el' => __( 'Greek', 'cyr2lat' ) . '
el', + 'hy' => __( 'Armenian', 'cyr2lat' ) . '
hy', + 'ka_GE' => __( 'Georgian', 'cyr2lat' ) . '
ka_GE', + 'kk' => __( 'Kazakh', 'cyr2lat' ) . '
kk', + 'he_IL' => __( 'Hebrew', 'cyr2lat' ) . '
he_IL', + 'zh_CN' => __( 'Chinese (China)', 'cyr2lat' ) . '
zh_CN', ]; } @@ -143,10 +119,10 @@ public function init_form_fields() { $current_locale = $this->get_current_locale(); foreach ( $this->locales as $locale => $info ) { - $current = ( $locale === $current_locale ) ? '
' . __( '(current)', 'cyr2lat' ) : ''; + $info = ( $locale === $current_locale ) ? $info . '
' . __( '(current)', 'cyr2lat' ) : $info; $this->form_fields[ $locale ] = [ - 'title' => $info['label'] . $current, + 'title' => $info, 'section' => $locale . '_section', 'type' => 'table', 'placeholder' => '', diff --git a/tests/unit/Settings/TablesTest.php b/tests/unit/Settings/TablesTest.php index ff0fead..4890ef7 100644 --- a/tests/unit/Settings/TablesTest.php +++ b/tests/unit/Settings/TablesTest.php @@ -161,42 +161,18 @@ public function test_init_locales() { $method->invoke( $subject ); $expected = [ - 'iso9' => [ - 'label' => __( 'ISO9 Table', 'cyr2lat' ), - ], - 'bel' => [ - 'label' => __( 'bel Table', 'cyr2lat' ), - ], - 'uk' => [ - 'label' => __( 'uk Table', 'cyr2lat' ), - ], - 'bg_BG' => [ - 'label' => __( 'bg_BG Table', 'cyr2lat' ), - ], - 'mk_MK' => [ - 'label' => __( 'mk_MK Table', 'cyr2lat' ), - ], - 'sr_RS' => [ - 'label' => __( 'sr_RS Table', 'cyr2lat' ), - ], - 'el' => [ - 'label' => __( 'el Table', 'cyr2lat' ), - ], - 'hy' => [ - 'label' => __( 'hy Table', 'cyr2lat' ), - ], - 'ka_GE' => [ - 'label' => __( 'ka_GE Table', 'cyr2lat' ), - ], - 'kk' => [ - 'label' => __( 'kk Table', 'cyr2lat' ), - ], - 'he_IL' => [ - 'label' => __( 'he_IL Table', 'cyr2lat' ), - ], - 'zh_CN' => [ - 'label' => __( 'zh_CN Table', 'cyr2lat' ), - ], + 'iso9' => 'Default
ISO9', + 'bel' => 'Belarusian
bel', + 'uk' => 'Ukrainian
uk', + 'bg_BG' => 'Bulgarian
bg_BG', + 'mk_MK' => 'Macedonian
mk_MK', + 'sr_RS' => 'Serbian
sr_RS', + 'el' => 'Greek
el', + 'hy' => 'Armenian
hy', + 'ka_GE' => 'Georgian
ka_GE', + 'kk' => 'Kazakh
kk', + 'he_IL' => 'Hebrew
he_IL', + 'zh_CN' => 'Chinese (China)
zh_CN', ]; self::assertSame( $expected, $this->get_protected_property( $subject, 'locales' ) ); @@ -252,7 +228,7 @@ static function ( $locale = '' ) { $expected = [ 'iso9' => [ - 'title' => 'ISO9 Table
(current)', + 'title' => 'Default
ISO9
(current)', 'section' => 'iso9_section', 'type' => 'table', 'placeholder' => '', @@ -265,7 +241,7 @@ static function ( $locale = '' ) { ], 'bel' => [ - 'title' => 'bel Table', + 'title' => 'Belarusian
bel', 'section' => 'bel_section', 'type' => 'table', 'placeholder' => '', @@ -278,7 +254,7 @@ static function ( $locale = '' ) { ], 'uk' => [ - 'title' => 'uk Table', + 'title' => 'Ukrainian
uk', 'section' => 'uk_section', 'type' => 'table', 'placeholder' => '', @@ -291,7 +267,7 @@ static function ( $locale = '' ) { ], 'bg_BG' => [ - 'title' => 'bg_BG Table', + 'title' => 'Bulgarian
bg_BG', 'section' => 'bg_BG_section', 'type' => 'table', 'placeholder' => '', @@ -304,7 +280,7 @@ static function ( $locale = '' ) { ], 'mk_MK' => [ - 'title' => 'mk_MK Table', + 'title' => 'Macedonian
mk_MK', 'section' => 'mk_MK_section', 'type' => 'table', 'placeholder' => '', @@ -317,7 +293,7 @@ static function ( $locale = '' ) { ], 'sr_RS' => [ - 'title' => 'sr_RS Table', + 'title' => 'Serbian
sr_RS', 'section' => 'sr_RS_section', 'type' => 'table', 'placeholder' => '', @@ -330,7 +306,7 @@ static function ( $locale = '' ) { ], 'el' => [ - 'title' => 'el Table', + 'title' => 'Greek
el', 'section' => 'el_section', 'type' => 'table', 'placeholder' => '', @@ -343,7 +319,7 @@ static function ( $locale = '' ) { ], 'hy' => [ - 'title' => 'hy Table', + 'title' => 'Armenian
hy', 'section' => 'hy_section', 'type' => 'table', 'placeholder' => '', @@ -356,7 +332,7 @@ static function ( $locale = '' ) { ], 'ka_GE' => [ - 'title' => 'ka_GE Table', + 'title' => 'Georgian
ka_GE', 'section' => 'ka_GE_section', 'type' => 'table', 'placeholder' => '', @@ -369,7 +345,7 @@ static function ( $locale = '' ) { ], 'kk' => [ - 'title' => 'kk Table', + 'title' => 'Kazakh
kk', 'section' => 'kk_section', 'type' => 'table', 'placeholder' => '', @@ -382,7 +358,7 @@ static function ( $locale = '' ) { ], 'he_IL' => [ - 'title' => 'he_IL Table', + 'title' => 'Hebrew
he_IL', 'section' => 'he_IL_section', 'type' => 'table', 'placeholder' => '', @@ -395,7 +371,7 @@ static function ( $locale = '' ) { ], 'zh_CN' => [ - 'title' => 'zh_CN Table', + 'title' => 'Chinese (China)
zh_CN', 'section' => 'zh_CN_section', 'type' => 'table', 'placeholder' => '',