Skip to content

Commit 393c3de

Browse files
committed
Theme text domain
1 parent 307f709 commit 393c3de

File tree

3 files changed

+54
-57
lines changed

3 files changed

+54
-57
lines changed

intervention.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
};
2222

2323
define('INTERVENTION_DIR', dirname(__FILE__));
24+
define('INTERVENTION_TEXT_DOMAIN', wp_get_theme()->get('TextDomain'));
2425

2526
/**
2627
* Support for Bedrock/Composer

src/Application/Support/Posttypes/Labels.php

Lines changed: 31 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -50,44 +50,42 @@ public function __construct($one, $many = false, $config = false)
5050
*/
5151
public function builder()
5252
{
53-
$theme = wp_get_theme();
54-
$i18n = $theme->get('TextDomain');
5553
$featured_image = $this->config->has('featured_image') ?
5654
$this->config->get('featured_image') :
5755
'Featured image';
5856

5957
$this->labels = Arr::collect([
60-
'name' => _x($this->many, 'Post type general name', $i18n),
61-
'singular_name' => _x($this->one, 'Post type singular name', $i18n),
62-
'menu_name' => _x($this->many, 'Admin Menu text', $i18n),
63-
'name_admin_bar' => _x($this->one, 'Add New on Toolbar', $i18n),
64-
'add_new' => __('Add New', $i18n),
65-
'add_new_item' => sprintf(__('Add New %s', $i18n), $this->one),
66-
'edit_item' => sprintf(__('Edit %s', $i18n), $this->one),
67-
'new_item' => sprintf(__('New %s', $i18n), $this->one),
68-
'view_item' => sprintf(__('View %s', $i18n), $this->one),
69-
'view_items' => sprintf(__('View %s', $i18n), $this->many),
70-
'search_items' => sprintf(__('Search %s', $i18n), $this->many),
71-
'not_found' => sprintf(__('No %s found.', $i18n), Str::lower($this->many)),
72-
'not_found_in_trash' => sprintf(__('No %s found in trash.', $i18n), Str::lower($this->many)),
73-
'parent_item_colon' => sprintf(__('Parent %s:', $i18n), $this->one),
74-
'all_items' => sprintf(__('All %s', $i18n), $this->many),
75-
'archives' => sprintf(__('%s Archives', $i18n), $this->one),
76-
'attributes' => sprintf(__('%s Attributes', $i18n), $this->one),
77-
'insert_into_item' => sprintf(__('Insert into %s', $i18n), Str::lower($this->one)),
78-
'uploaded_to_this_item' => sprintf(__('Uploaded to this %s', $i18n), Str::lower($this->one)),
79-
'filter_items_list' => sprintf(__('Filter %s list', $i18n), Str::lower($this->many)),
80-
'items_list_navigation' => sprintf(__('%s list navigation', $i18n), $this->many),
81-
'items_list' => sprintf(__('%s list', $i18n), $this->many),
82-
'item_published' => sprintf(__('%s published.', $i18n), $this->one),
83-
'item_published_privately' => sprintf(__('%s published privately.', $i18n), $this->one),
84-
'item_reverted_to_draft' => sprintf(__('%s reverted to draft.', $i18n), $this->one),
85-
'item_scheduled' => sprintf(__('%s scheduled.', $i18n), $this->one),
86-
'item_updated' => sprintf(__('%s updated.', $i18n), $this->one),
87-
'featured_image' => __($featured_image, $i18n),
88-
'set_featured_image' => sprintf(__('Set %s', $i18n), Str::lower($featured_image)),
89-
'remove_featured_image' => sprintf(__('Remove %s', $i18n), Str::lower($featured_image)),
90-
'use_featured_image' => sprintf(__('Use as %s', $i18n), Str::lower($featured_image)),
58+
'name' => _x($this->many, 'Post type general name', INTERVENTION_TEXT_DOMAIN),
59+
'singular_name' => _x($this->one, 'Post type singular name', INTERVENTION_TEXT_DOMAIN),
60+
'menu_name' => _x($this->many, 'Admin Menu text', INTERVENTION_TEXT_DOMAIN),
61+
'name_admin_bar' => _x($this->one, 'Add New on Toolbar', INTERVENTION_TEXT_DOMAIN),
62+
'add_new' => __('Add New', INTERVENTION_TEXT_DOMAIN),
63+
'add_new_item' => sprintf(__('Add New %s', INTERVENTION_TEXT_DOMAIN), $this->one),
64+
'edit_item' => sprintf(__('Edit %s', INTERVENTION_TEXT_DOMAIN), $this->one),
65+
'new_item' => sprintf(__('New %s', INTERVENTION_TEXT_DOMAIN), $this->one),
66+
'view_item' => sprintf(__('View %s', INTERVENTION_TEXT_DOMAIN), $this->one),
67+
'view_items' => sprintf(__('View %s', INTERVENTION_TEXT_DOMAIN), $this->many),
68+
'search_items' => sprintf(__('Search %s', INTERVENTION_TEXT_DOMAIN), $this->many),
69+
'not_found' => sprintf(__('No %s found.', INTERVENTION_TEXT_DOMAIN), Str::lower($this->many)),
70+
'not_found_in_trash' => sprintf(__('No %s found in trash.', INTERVENTION_TEXT_DOMAIN), Str::lower($this->many)),
71+
'parent_item_colon' => sprintf(__('Parent %s:', INTERVENTION_TEXT_DOMAIN), $this->one),
72+
'all_items' => sprintf(__('All %s', INTERVENTION_TEXT_DOMAIN), $this->many),
73+
'archives' => sprintf(__('%s Archives', INTERVENTION_TEXT_DOMAIN), $this->one),
74+
'attributes' => sprintf(__('%s Attributes', INTERVENTION_TEXT_DOMAIN), $this->one),
75+
'insert_into_item' => sprintf(__('Insert into %s', INTERVENTION_TEXT_DOMAIN), Str::lower($this->one)),
76+
'uploaded_to_this_item' => sprintf(__('Uploaded to this %s', INTERVENTION_TEXT_DOMAIN), Str::lower($this->one)),
77+
'filter_items_list' => sprintf(__('Filter %s list', INTERVENTION_TEXT_DOMAIN), Str::lower($this->many)),
78+
'items_list_navigation' => sprintf(__('%s list navigation', INTERVENTION_TEXT_DOMAIN), $this->many),
79+
'items_list' => sprintf(__('%s list', INTERVENTION_TEXT_DOMAIN), $this->many),
80+
'item_published' => sprintf(__('%s published.', INTERVENTION_TEXT_DOMAIN), $this->one),
81+
'item_published_privately' => sprintf(__('%s published privately.', INTERVENTION_TEXT_DOMAIN), $this->one),
82+
'item_reverted_to_draft' => sprintf(__('%s reverted to draft.', INTERVENTION_TEXT_DOMAIN), $this->one),
83+
'item_scheduled' => sprintf(__('%s scheduled.', INTERVENTION_TEXT_DOMAIN), $this->one),
84+
'item_updated' => sprintf(__('%s updated.', INTERVENTION_TEXT_DOMAIN), $this->one),
85+
'featured_image' => __($featured_image, INTERVENTION_TEXT_DOMAIN),
86+
'set_featured_image' => sprintf(__('Set %s', INTERVENTION_TEXT_DOMAIN), Str::lower($featured_image)),
87+
'remove_featured_image' => sprintf(__('Remove %s', INTERVENTION_TEXT_DOMAIN), Str::lower($featured_image)),
88+
'use_featured_image' => sprintf(__('Use as %s', INTERVENTION_TEXT_DOMAIN), Str::lower($featured_image)),
9189
]);
9290

9391
$this->labels = $this->labels->merge($this->config->toArray());

src/Application/Support/Taxonomies/Labels.php

Lines changed: 22 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -50,35 +50,33 @@ public function __construct($one, $many = false, $config = false)
5050
*/
5151
public function builder()
5252
{
53-
$theme = wp_get_theme();
54-
$i18n = $theme->get('TextDomain');
5553
$featured_image = $this->config->has('featured_image') ?
5654
$this->config->get('featured_image') :
5755
'Featured image';
5856

5957
$this->labels = Arr::collect([
60-
'menu_name' => __($this->many, $i18n),
61-
'name' => _x($this->many, 'Taxonomy general name', $i18n),
62-
'singular_name' => _x($this->one, 'Taxonomy single name', $i18n),
63-
'search_items' => sprintf(__('Search %s', $i18n), $this->many),
64-
'popular_items' => sprintf(__('Popular %s', $i18n), $this->many),
65-
'all_items' => sprintf(__('All %s', $i18n), $this->many),
66-
'parent_item' => sprintf(__('Parent %s', $i18n), $this->one),
67-
'parent_item_colon' => sprintf(__('Parent %s:', $i18n), $this->one),
68-
'edit_item' => sprintf(__('Edit %s', $i18n), $this->one),
69-
'view_item' => sprintf(__('View %s', $i18n), $this->one),
70-
'update_item' => sprintf(__('Update %s', $i18n), $this->one),
71-
'add_new_item' => sprintf(__('Add New %s', $i18n), $this->one),
72-
'new_item_name' => sprintf(__('New %s Name', $i18n), $this->one),
73-
'separate_items_with_commas' => sprintf(__('Separate %s with commas', $i18n), Str::lower($this->many)),
74-
'add_or_remove_items' => sprintf(__('Add or remove %s', $i18n), Str::lower($this->many)),
75-
'choose_from_most_used' => sprintf(__('Choose from most used %s', $i18n), Str::lower($this->many)),
76-
'not_found' => sprintf(__('No %s found', $i18n), Str::lower($this->many)),
77-
'no_terms' => sprintf(__('No %s', $i18n), Str::lower($this->many)),
78-
'items_list_navigation' => sprintf(__('%s list navigation', $i18n), $this->many),
79-
'items_list' => sprintf(__('%s list', $i18n), $this->many),
80-
'most_used' => __('Most Used', $i18n),
81-
'back_to_items' => sprintf(__('← Back to %s', $i18n), $this->many),
58+
'menu_name' => __($this->many, INTERVENTION_TEXT_DOMAIN),
59+
'name' => _x($this->many, 'Taxonomy general name', INTERVENTION_TEXT_DOMAIN),
60+
'singular_name' => _x($this->one, 'Taxonomy single name', INTERVENTION_TEXT_DOMAIN),
61+
'search_items' => sprintf(__('Search %s', INTERVENTION_TEXT_DOMAIN), $this->many),
62+
'popular_items' => sprintf(__('Popular %s', INTERVENTION_TEXT_DOMAIN), $this->many),
63+
'all_items' => sprintf(__('All %s', INTERVENTION_TEXT_DOMAIN), $this->many),
64+
'parent_item' => sprintf(__('Parent %s', INTERVENTION_TEXT_DOMAIN), $this->one),
65+
'parent_item_colon' => sprintf(__('Parent %s:', INTERVENTION_TEXT_DOMAIN), $this->one),
66+
'edit_item' => sprintf(__('Edit %s', INTERVENTION_TEXT_DOMAIN), $this->one),
67+
'view_item' => sprintf(__('View %s', INTERVENTION_TEXT_DOMAIN), $this->one),
68+
'update_item' => sprintf(__('Update %s', INTERVENTION_TEXT_DOMAIN), $this->one),
69+
'add_new_item' => sprintf(__('Add New %s', INTERVENTION_TEXT_DOMAIN), $this->one),
70+
'new_item_name' => sprintf(__('New %s Name', INTERVENTION_TEXT_DOMAIN), $this->one),
71+
'separate_items_with_commas' => sprintf(__('Separate %s with commas', INTERVENTION_TEXT_DOMAIN), Str::lower($this->many)),
72+
'add_or_remove_items' => sprintf(__('Add or remove %s', INTERVENTION_TEXT_DOMAIN), Str::lower($this->many)),
73+
'choose_from_most_used' => sprintf(__('Choose from most used %s', INTERVENTION_TEXT_DOMAIN), Str::lower($this->many)),
74+
'not_found' => sprintf(__('No %s found', INTERVENTION_TEXT_DOMAIN), Str::lower($this->many)),
75+
'no_terms' => sprintf(__('No %s', INTERVENTION_TEXT_DOMAIN), Str::lower($this->many)),
76+
'items_list_navigation' => sprintf(__('%s list navigation', INTERVENTION_TEXT_DOMAIN), $this->many),
77+
'items_list' => sprintf(__('%s list', INTERVENTION_TEXT_DOMAIN), $this->many),
78+
'most_used' => __('Most Used', INTERVENTION_TEXT_DOMAIN),
79+
'back_to_items' => sprintf(__('← Back to %s', INTERVENTION_TEXT_DOMAIN), $this->many),
8280
]);
8381

8482
$this->labels = $this->labels->merge($this->config->toArray());

0 commit comments

Comments
 (0)