Skip to content

Commit

Permalink
Merge pull request #12 from cracker182/master
Browse files Browse the repository at this point in the history
improvement for assets (config/translation)
  • Loading branch information
mtownsend5512 authored Jan 18, 2019
2 parents 3cc439e + 681e11d commit 12f8915
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
composer.lock
vendor
.DS_Store
.DS_Store
.idea
9 changes: 7 additions & 2 deletions src/Providers/ReadTimeServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,16 @@ class ReadTimeServiceProvider extends ServiceProvider
*/
public function boot()
{
$this->loadTranslationsFrom(__DIR__.'/../resources/lang/', 'read-time');

$this->publishes([
__DIR__ . '/../config/read-time.php' => config_path('read-time.php')
], 'read-time-config');

$this->publishes([
__DIR__ . "/../resources/lang/" => resource_path("lang/")
__DIR__ . "/../resources/lang/" => resource_path("lang/vendor/read-time")
], 'read-time-language-files');

}

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

$this->mergeConfigFrom(__DIR__.'/../config/read-time.php', 'read-time');

$content = $data['content'];
$omitSeconds = isset($data['omit_seconds']) ? $data['omit_seconds'] : config('read-time.omit_seconds');
$timeOnly = isset($data['time_only']) ? $data['time_only'] : config('read-time.time_only');
$abbreviated = isset($data['abbreviated']) ? $data['abbreviated'] : config('read-time.abbreviate_time_measurements');
$wordsPerMinute = isset($data['words_per_minute']) ? $data['words_per_minute'] : config('read-time.words_per_minute');
$ltr = isset($data['ltr']) ? $data['ltr'] : __('read-time.reads_left_to_right');
$translation = isset($data['translation']) ? $data['translation'] : __('read-time');
$translation = isset($data['translation']) ? $data['translation'] : __('read-time::read-time');

return (new ReadTime($content))
->omitSeconds($omitSeconds)
Expand Down

0 comments on commit 12f8915

Please sign in to comment.