Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
drupal
Commits
ffdfab24
Commit
ffdfab24
authored
Mar 31, 2015
by
alexpott
Browse files
Issue
#2457703
by Gábor Hojtsy: Default translatable site name is "Drupal" (incorrectly)
parent
2492b802
Changes
5
Hide whitespace changes
Inline
Side-by-side
core/modules/config/src/Tests/ConfigSchemaTest.php
View file @
ffdfab24
...
...
@@ -288,14 +288,8 @@ function testSchemaMappingWithParents() {
* Tests metadata applied to configuration objects.
*/
function
testSchemaData
()
{
// Try
some
simple propert
ies
.
// Try
a
simple propert
y
.
$meta
=
\
Drupal
::
service
(
'config.typed'
)
->
get
(
'system.site'
);
$property
=
$meta
->
get
(
'name'
);
$this
->
assertTrue
(
$property
instanceof
StringInterface
,
'Got the right wrapper fo the site name property.'
);
$this
->
assertEqual
(
$property
->
getValue
(),
'Drupal'
,
'Got the right string value for site name data.'
);
$definition
=
$property
->
getDataDefinition
();
$this
->
assertTrue
(
$definition
[
'translatable'
],
'Got the right translatability setting for site name data.'
);
$property
=
$meta
->
get
(
'page'
)
->
get
(
'front'
);
$this
->
assertTrue
(
$property
instanceof
StringInterface
,
'Got the right wrapper fo the page.front property.'
);
$this
->
assertEqual
(
$property
->
getValue
(),
'user/login'
,
'Got the right value for page.front data.'
);
...
...
core/modules/locale/src/Tests/LocaleConfigTranslationTest.php
View file @
ffdfab24
...
...
@@ -7,6 +7,7 @@
namespace
Drupal\locale\Tests
;
use
Drupal\Component\Utility\SafeMarkup
;
use
Drupal\simpletest\WebTestBase
;
use
Drupal\core\language\languageInterface
;
...
...
@@ -45,7 +46,7 @@ protected function setUp() {
public
function
testConfigTranslation
()
{
// Add custom language.
$langcode
=
'xx'
;
$admin_user
=
$this
->
drupalCreateUser
(
array
(
'administer languages'
,
'access administration pages'
,
'translate interface'
,
'administer modules'
,
'access site-wide contact form'
,
'administer contact forms'
));
$admin_user
=
$this
->
drupalCreateUser
(
array
(
'administer languages'
,
'access administration pages'
,
'translate interface'
,
'administer modules'
,
'access site-wide contact form'
,
'administer contact forms'
,
'administer site configuration'
));
$this
->
drupalLogin
(
$admin_user
);
$name
=
$this
->
randomMachineName
(
16
);
$edit
=
array
(
...
...
@@ -59,12 +60,13 @@ public function testConfigTranslation() {
$edit
=
array
(
"prefix[
$langcode
]"
=>
$langcode
);
$this
->
drupalPostForm
(
'admin/config/regional/language/detection/url'
,
$edit
,
t
(
'Save configuration'
));
// Check site name string exists and create translation for it.
$string
=
$this
->
storage
->
findString
(
array
(
'source'
=>
'Drupal'
,
'context'
=>
''
,
'type'
=>
'configuration'
));
// Check that the maintenance message exists and create translation for it.
$source
=
'@site is currently under maintenance. We should be back shortly. Thank you for your patience.'
;
$string
=
$this
->
storage
->
findString
(
array
(
'source'
=>
$source
,
'context'
=>
''
,
'type'
=>
'configuration'
));
$this
->
assertTrue
(
$string
,
'Configuration strings have been created upon installation.'
);
// Translate using the UI so configuration is refreshed.
$
site_nam
e
=
$this
->
randomMachineName
(
20
);
$
messag
e
=
$this
->
randomMachineName
(
20
);
$search
=
array
(
'string'
=>
$string
->
source
,
'langcode'
=>
$langcode
,
...
...
@@ -75,18 +77,14 @@ public function testConfigTranslation() {
$textarea
=
current
(
$textareas
);
$lid
=
(
string
)
$textarea
[
0
][
'name'
];
$edit
=
array
(
$lid
=>
$
site_nam
e
,
$lid
=>
$
messag
e
,
);
$this
->
drupalPostForm
(
'admin/config/regional/translate'
,
$edit
,
t
(
'Save translations'
));
// Get translation and check we've only got the
site nam
e.
$translation
=
\
Drupal
::
languageManager
()
->
getLanguageConfigOverride
(
$langcode
,
'system.
sit
e'
)
->
get
();
// Get translation and check we've only got the
messag
e.
$translation
=
\
Drupal
::
languageManager
()
->
getLanguageConfigOverride
(
$langcode
,
'system.
maintenanc
e'
)
->
get
();
$this
->
assertEqual
(
count
(
$translation
),
1
,
'Got the right number of properties after translation.'
);
$this
->
assertEqual
(
$translation
[
'name'
],
$site_name
,
'Got the right translation for the site name.'
);
// Check the translated site name is displayed.
$this
->
drupalGet
(
$langcode
);
$this
->
assertText
(
$site_name
,
'The translated site name is displayed after translations refreshed.'
);
$this
->
assertEqual
(
$translation
[
'message'
],
$message
);
// Check default medium date format exists and create a translation for it.
$string
=
$this
->
storage
->
findString
(
array
(
'source'
=>
'D, m/d/Y - H:i'
,
'context'
=>
'PHP date format'
,
'type'
=>
'configuration'
));
...
...
core/modules/system/config/install/system.site.yml
View file @
ffdfab24
uuid
:
'
'
name
:
Drupal
name
:
'
'
mail
:
'
'
slogan
:
'
'
page
:
...
...
core/modules/system/src/Tests/System/TokenReplaceUnitTest.php
View file @
ffdfab24
...
...
@@ -18,6 +18,15 @@
*/
class
TokenReplaceUnitTest
extends
TokenReplaceUnitTestBase
{
/**
* @inheritdoc
*/
protected
function
setUp
()
{
parent
::
setUp
();
// Set the site name to something other than an empty string.
$this
->
config
(
'system.site'
)
->
set
(
'name'
,
'Drupal'
)
->
save
();
}
/**
* Test whether token-replacement works in various contexts.
*/
...
...
core/modules/system/system.install
View file @
ffdfab24
...
...
@@ -644,10 +644,13 @@ function system_install() {
$cron_key
=
Crypt
::
randomBytesBase64
(
55
);
\
Drupal
::
state
()
->
set
(
'system.cron_key'
,
$cron_key
);
// Populate the site UUID.
\
Drupal
::
configFactory
()
->
getEditable
(
'system.site'
)
->
set
(
'uuid'
,
\
Drupal
::
service
(
'uuid'
)
->
generate
())
->
save
();
// Populate the site UUID and default name (if not set).
$site
=
\
Drupal
::
configFactory
()
->
getEditable
(
'system.site'
);
$site
->
set
(
'uuid'
,
\
Drupal
::
service
(
'uuid'
)
->
generate
());
if
(
!
$site
->
get
(
'name'
))
{
$site
->
set
(
'name'
,
'Drupal'
);
}
$site
->
save
();
}
/**
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment