Skip to content

Commit 2e6e4d9

Browse files
committed
setup language registration.
1 parent 62ebf97 commit 2e6e4d9

4 files changed

Lines changed: 30 additions & 15 deletions

File tree

app/app.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,28 @@
5656
$app[$key] = $value;
5757
}
5858

59+
/*
60+
|--------------------------------------------------------------------------
61+
| Load The Application Translation Messages
62+
|--------------------------------------------------------------------------
63+
|
64+
| Here we'll load all of the language messages for the application, which
65+
| are all stored in a single language file. The translator service is
66+
| automatically registered for us via the core services provider.
67+
|
68+
*/
69+
70+
$messages = require __DIR__.'/lang.php';
71+
72+
$domains = array();
73+
74+
if (isset($app['translator.domains']))
75+
{
76+
$domains = $app['translator.domains'];
77+
}
78+
79+
$app['translator.domains'] = array_merge($domains, compact('messages'));
80+
5981
/*
6082
|--------------------------------------------------------------------------
6183
| Register The Core Service Provider

app/lang.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?php
2+
3+
return array(
4+
5+
'en' => array(),
6+
7+
);

app/routes.php

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,5 @@
1414

1515
$app->get('/', function() use ($app)
1616
{
17-
/*
18-
$app['locale'] = 'en';
19-
$app->register(new Silex\Provider\TranslationServiceProvider, array(
20-
'locale' => 'en',
21-
'locale_fallback' => 'en',
22-
'translator.domains' => array(
23-
'messages' => array(
24-
'en' => array(
25-
'hello' => 'Hello, :name',
26-
),
27-
),
28-
),
29-
));
30-
*/
3117
return $app->twig->render('hello.twig.html');
3218
});

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
22
"require": {
3-
"illuminate/foundation": ">=1.0.0",
3+
"illuminate/foundation": ">=1.0.0"
44
}
55
}

0 commit comments

Comments
 (0)