Task

Convert the following theme functions to use the new table #type:

Module Theme function name Where in Code What is it really?
locale theme_locale_translate_edit_form_strings function form table w/ pager

Steps to Reproduce

  1. drush en locale -y
  2. Add a language at /admin/config/regional/language/add
  3. Visit the admin page at /admin/config/regional/translate

Related issues

Reference: https://www.drupal.org/core/beta-changes
Issue category Task because parent item #1876712: [meta] Convert all tables in core to new #type 'table' is a task
Issue priority Major because parent item #1876712: [meta] Convert all tables in core to new #type 'table' is Major.
Prioritized changes The main goal of this issue is to be children for meta issue #1876712: [meta] Convert all tables in core to new #type 'table'. These issues were recently moved to Major.
Disruption This change should not be considered disruptive because markup and functionality are not changing, just the method used to generate the markup.

Comments

joelpittet’s picture

Assigned: Unassigned » joelpittet

Taking a crack, one of these will go through

joelpittet’s picture

Assigned: joelpittet » Unassigned

Got nowhere slowly... going to give up on this one, first thought though was doesn't need #type=>table because it doesn't need tableselect or tabledrag... but that seems to take it out of the form_api and none of the textarea's get #value properties.

duellj’s picture

Assigned: Unassigned » duellj
Status: Active » Needs review
StatusFileSize
new5.13 KB

This patch should pass, let's see what testbot says

duellj’s picture

#3: 1938916-3-locale-tables.patch queued for re-testing.

joelpittet’s picture

#3: 1938916-3-locale-tables.patch queued for re-testing.

jibran’s picture

Issue tags: +Novice

Tagging.

steinmb’s picture

Profiling data

admin/config/regional/translate

=== 8.x..8.x compared (519feaa2b1af9..519fee1c89203):

ct  : 60,623|60,623|0|0.0%
wt  : 284,555|284,692|137|0.0%
cpu : 260,739|261,023|284|0.1%
mu  : 12,707,864|12,707,864|0|0.0%
pmu : 12,902,160|12,902,160|0|0.0%

=== 8.x..twig-locale-table-1938916 compared (519feaa2b1af9..519feedd48170):

ct  : 60,623|58,138|-2,485|-4.1%
wt  : 284,555|276,055|-8,500|-3.0%
cpu : 260,739|251,918|-8,821|-3.4%
mu  : 12,707,864|12,543,984|-163,880|-1.3%
pmu : 12,902,160|12,793,704|-108,456|-0.8%

ct = function calls, wt = wall time, cpu = cpu time used, mu = memory usage, pmu = peak memory usage
joelpittet’s picture

Status: Needs review » Needs work
Issue tags: -Novice
StatusFileSize
new136.07 KB
new136.67 KB

The profiling looks great. Though there is a markup issue that needs to be addressed.

Screenshot_2013-06-11_12_02_AM.png

Screenshot_2013-06-11_12_04_AM.png

joelpittet’s picture

+++ b/core/modules/locale/locale.pages.inc
@@ -692,48 +694,6 @@ function _locale_translation_status_debug_info($source) {
-  $output .= theme('pager');

Also missing pager

internetdevels’s picture

Assigned: duellj » Unassigned
Issue summary: View changes
Status: Needs work » Needs review
StatusFileSize
new5.59 KB

Rerolled patch with added pager attached.

Status: Needs review » Needs work

The last submitted patch, 10: drupal-convert_locale_theme_table-1938916-10.patch, failed testing.

internetdevels’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 10: drupal-convert_locale_theme_table-1938916-10.patch, failed testing.

joelpittet’s picture

Status: Needs work » Needs review
Issue tags: +needs profiling, +Needs manual testing

Tests pass locally, retesting. Also needs another round of markup and performance testing because the theme function was removed though not used.

f5.andrii’s picture

akalata’s picture

Issue tags: +Needs reroll
akalata’s picture

Issue tags: -Needs reroll
StatusFileSize
new5.22 KB

Rerolled

a-fro’s picture

@akalata, here's a code review.

+++ b/core/modules/locale/src/Form/TranslateEditForm.php
@@ -44,10 +44,17 @@ public function buildForm(array $form, FormStateInterface $form_state) {
+        t('Source string'),

Per Joel's previous suggestions, please use the updated array [] syntax and injected $this->t() in the #header array.

Regarding manually testing, I had to add a language at /admin/config/regional/language/add, then I could see the table at /admin/config/regional/translate.

I've attached an image of where it breaks. I think it's the removed lines 65 and 70, which include
and tags that need to be fixed. @joelpittet may have suggestions if you have questions.

a-fro’s picture

Issue summary: View changes
akalata’s picture

Thanks @a-fro!

Attached an update after working with @joelpittet. We also noticed that the $string->context isn't being saved into the database -- maybe that part is blocked by #1035716: [policy, no patch] Decide and document guidelines for using string context?

akalata’s picture

@joelpittet and @a-fro saw that I'd commented a conditional to test $string->comment; adding that back!

The last submitted patch, 20: 1938916-convert_locale_theme_table-20.patch, failed testing.

joelpittet’s picture

Issue tags: -needs profiling
StatusFileSize
new6.52 KB

This doesn't need profiling it's admin facing theme function conversions. I believe manual testing on this patch is all that is needed as everything seems to look good for me.

This patch is just minor nitpicky formatting that I hope is not too much but tried to minimize the patch diff by not changing everything.

a-fro’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new122.58 KB
new60.3 KB
new60.28 KB

Manual testing results were that the id on the table is still removed (expected and desired), xhtml br tags are now html5 (without closing slash) and the strings id's of the singular/plural have been replaced with indexes. @joelpittet said that is not a problem because they are not being targeted by css or js. Marking as rtbc.

akalata’s picture

Following up on my $string->context question from #20, I've found that a small number of imported translations have context data. I'm assuming they all should, but confirming that this is a different issue than this one.

alexpott’s picture

Status: Reviewed & tested by the community » Needs work
+++ b/core/modules/locale/src/Form/TranslateEditForm.php
@@ -76,31 +78,37 @@ public function buildForm(array $form, FormStateInterface $form_state) {
+            '#template' => '<br /><small>{{ context_title }}: <span lang="en">{{ context }}</span></small>',

The br should not have a closing slash.

xhtml br tags are now html5 (without closing slash)

joelpittet’s picture

Status: Needs work » Needs review
Issue tags: -Needs manual testing
StatusFileSize
new6.51 KB
new988 bytes

Thanks for catching that, saves me from doing that again in the self-closing #1388926: Remove all references to "self-closing" void elements in core

lauriii’s picture

Status: Needs review » Reviewed & tested by the community

Tested this manually and didn't find any visual changes. Code looks also good to me so lets go.

alexpott’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs issue summary update

This issue is a normal task so we need to outline how it fits within the allowable Drupal 8 beta criteria. Can someone add Drupal 8 beta phase evaluation template to the issue summary.

lauriii’s picture

Priority: Normal » Major
Issue summary: View changes
Status: Needs work » Reviewed & tested by the community
Issue tags: -Needs issue summary update
StatusFileSize
new288.88 KB

Everything looks still good and patch applies. I also added the beta evaluation.

Locale tables after patch:

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed d4e8abd and pushed to 8.0.x. Thanks!

Thanks for adding the beta evaluation for to the issue summary.

  • alexpott committed d4e8abd on 8.0.x
    Issue #1938916 by joelpittet, akalata, a-fro, duellj, InternetDevels,...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.