Skip to content

Commit 12f8915

Browse files
Merge pull request #12 from cracker182/master
improvement for assets (config/translation)
2 parents 3cc439e + 681e11d commit 12f8915

2 files changed

Lines changed: 9 additions & 3 deletions

File tree

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
composer.lock
22
vendor
3-
.DS_Store
3+
.DS_Store
4+
.idea

src/Providers/ReadTimeServiceProvider.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,16 @@ class ReadTimeServiceProvider extends ServiceProvider
1616
*/
1717
public function boot()
1818
{
19+
$this->loadTranslationsFrom(__DIR__.'/../resources/lang/', 'read-time');
20+
1921
$this->publishes([
2022
__DIR__ . '/../config/read-time.php' => config_path('read-time.php')
2123
], 'read-time-config');
2224

2325
$this->publishes([
24-
__DIR__ . "/../resources/lang/" => resource_path("lang/")
26+
__DIR__ . "/../resources/lang/" => resource_path("lang/vendor/read-time")
2527
], 'read-time-language-files');
28+
2629
}
2730

2831
/**
@@ -37,13 +40,15 @@ public function register()
3740
throw new Exception('Content must be supplied to ReadTime class');
3841
}
3942

43+
$this->mergeConfigFrom(__DIR__.'/../config/read-time.php', 'read-time');
44+
4045
$content = $data['content'];
4146
$omitSeconds = isset($data['omit_seconds']) ? $data['omit_seconds'] : config('read-time.omit_seconds');
4247
$timeOnly = isset($data['time_only']) ? $data['time_only'] : config('read-time.time_only');
4348
$abbreviated = isset($data['abbreviated']) ? $data['abbreviated'] : config('read-time.abbreviate_time_measurements');
4449
$wordsPerMinute = isset($data['words_per_minute']) ? $data['words_per_minute'] : config('read-time.words_per_minute');
4550
$ltr = isset($data['ltr']) ? $data['ltr'] : __('read-time.reads_left_to_right');
46-
$translation = isset($data['translation']) ? $data['translation'] : __('read-time');
51+
$translation = isset($data['translation']) ? $data['translation'] : __('read-time::read-time');
4752

4853
return (new ReadTime($content))
4954
->omitSeconds($omitSeconds)

0 commit comments

Comments
 (0)