Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
drupal
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
drupal
Commits
a72d1f1b
Commit
a72d1f1b
authored
12 years ago
by
Dries Buytaert
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#2004684
by mgifford, Schnitzel: Improve Accessibility for String Translation UI.
parent
7a0c707e
No related branches found
No related tags found
2 merge requests
!7452
Issue #1797438. HTML5 validation is preventing form submit and not fully...
,
!789
Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
core/modules/locale/lib/Drupal/locale/Tests/LocaleTranslationUiTest.php
+1
-1
1 addition, 1 deletion
...ocale/lib/Drupal/locale/Tests/LocaleTranslationUiTest.php
core/modules/locale/locale.pages.inc
+13
-6
13 additions, 6 deletions
core/modules/locale/locale.pages.inc
with
14 additions
and
7 deletions
core/modules/locale/lib/Drupal/locale/Tests/LocaleTranslationUiTest.php
+
1
−
1
View file @
a72d1f1b
...
...
@@ -98,7 +98,7 @@ function testStringTranslation() {
);
// No t() here, it's surely not translated yet.
$this
->
assertText
(
$name
,
t
(
'name found on edit screen.'
));
$this
->
assertNo
Text
(
'English
'
,
t
(
'No way to translate the string to English.'
));
$this
->
assertNo
Option
(
'edit-langcode'
,
'en
'
,
t
(
'No way to translate the string to English.'
));
$this
->
drupalLogout
();
$this
->
drupalLogin
(
$admin_user
);
$this
->
drupalPost
(
'admin/config/regional/language/edit/en'
,
array
(
'locale_translate_english'
=>
TRUE
),
t
(
'Save language'
));
...
...
This diff is collapsed.
Click to expand it.
core/modules/locale/locale.pages.inc
+
13
−
6
View file @
a72d1f1b
...
...
@@ -297,9 +297,9 @@ function locale_translate_edit_form($form, &$form_state) {
);
$form
[
'strings'
][
$string
->
lid
][
'original'
]
=
array
(
'#type'
=>
'item'
,
'#title'
=>
t
(
'Source string
'
),
'#title'
=>
t
(
'Source string
(@language)'
,
array
(
'@language'
=>
t
(
'Built-in English'
))
),
'#title_display'
=>
'invisible'
,
'#markup'
=>
check_plain
(
$source_array
[
0
]),
'#markup'
=>
'<span lang="en">'
.
check_plain
(
$source_array
[
0
])
.
'</span>'
,
);
}
else
{
...
...
@@ -311,18 +311,19 @@ function locale_translate_edit_form($form, &$form_state) {
$form
[
'strings'
][
$string
->
lid
][
'original_singular'
]
=
array
(
'#type'
=>
'item'
,
'#title'
=>
t
(
'Singular form'
),
'#markup'
=>
check_plain
(
$source_array
[
0
]),
'#markup'
=>
'<span lang="en">'
.
check_plain
(
$source_array
[
0
])
.
'</span>'
,
'#prefix'
=>
'<span class="visually-hidden">'
.
t
(
'Source string (@language)'
,
array
(
'@language'
=>
t
(
'Built-in English'
)))
.
'</span>'
,
);
$form
[
'strings'
][
$string
->
lid
][
'original_plural'
]
=
array
(
'#type'
=>
'item'
,
'#title'
=>
t
(
'Plural form'
),
'#markup'
=>
check_plain
(
$source_array
[
1
]),
'#markup'
=>
'<span lang="en">'
.
check_plain
(
$source_array
[
1
])
.
'</span>'
,
);
}
if
(
!
empty
(
$string
->
context
))
{
$form
[
'strings'
][
$string
->
lid
][
'context'
]
=
array
(
'#type'
=>
'value'
,
'#value'
=>
check_plain
(
$string
->
context
),
'#value'
=>
'<span lang="en">'
.
check_plain
(
$string
->
context
)
.
'</span>'
,
);
}
// Approximate the number of rows to use in the default textarea.
...
...
@@ -330,10 +331,11 @@ function locale_translate_edit_form($form, &$form_state) {
if
(
empty
(
$form
[
'strings'
][
$string
->
lid
][
'plural'
][
'#value'
]))
{
$form
[
'strings'
][
$string
->
lid
][
'translations'
][
0
]
=
array
(
'#type'
=>
'textarea'
,
'#title'
=>
t
(
'Translated string
'
),
'#title'
=>
t
(
'Translated string
(@language)'
,
array
(
'@language'
=>
$langname
)
),
'#title_display'
=>
'invisible'
,
'#rows'
=>
$rows
,
'#default_value'
=>
$translation_array
[
0
],
'#attributes'
=>
array
(
'lang'
=>
$langcode
),
);
}
else
{
...
...
@@ -346,6 +348,8 @@ function locale_translate_edit_form($form, &$form_state) {
'#title'
=>
(
$i
==
0
?
t
(
'Singular form'
)
:
format_plural
(
$i
,
'First plural form'
,
'@count. plural form'
)),
'#rows'
=>
$rows
,
'#default_value'
=>
isset
(
$translation_array
[
$i
])
?
$translation_array
[
$i
]
:
''
,
'#attributes'
=>
array
(
'lang'
=>
$langcode
),
'#prefix'
=>
$i
==
0
?
(
'<span class="visually-hidden">'
.
t
(
'Translated string (@language)'
,
array
(
'@language'
=>
$langname
))
.
'</span>'
)
:
''
,
);
}
}
...
...
@@ -356,12 +360,15 @@ function locale_translate_edit_form($form, &$form_state) {
'#title'
=>
t
(
'Singular form'
),
'#rows'
=>
$rows
,
'#default_value'
=>
$translation_array
[
0
],
'#attributes'
=>
array
(
'lang'
=>
$langcode
),
'#prefix'
=>
'<span class="visually-hidden">'
.
t
(
'Translated string (@language)'
,
array
(
'@language'
=>
$langname
))
.
'</span>'
,
);
$form
[
'strings'
][
$string
->
lid
][
'translations'
][
1
]
=
array
(
'#type'
=>
'textarea'
,
'#title'
=>
t
(
'Plural form'
),
'#rows'
=>
$rows
,
'#default_value'
=>
isset
(
$translation_array
[
1
])
?
$translation_array
[
1
]
:
''
,
'#attributes'
=>
array
(
'lang'
=>
$langcode
),
);
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment