-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #126 from newfold-labs/press4-277
Press4 277
- Loading branch information
Showing
12 changed files
with
3,327 additions
and
454 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
<?php return array('dependencies' => array('lodash', 'moment', 'react', 'wp-api-fetch', 'wp-data', 'wp-date', 'wp-dom-ready', 'wp-element', 'wp-i18n', 'wp-url'), 'version' => 'a5f290ac68f9d69a100b'); | ||
<?php return array('dependencies' => array('lodash', 'moment', 'react', 'wp-api-fetch', 'wp-data', 'wp-date', 'wp-dom-ready', 'wp-element', 'wp-i18n', 'wp-url'), 'version' => 'd92107dfb0bd29fc36c3'); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php | ||
|
||
namespace NewfoldLabs\WP\Module\ECommerce; | ||
|
||
/** | ||
* Class for handling internationalization. | ||
*/ | ||
class I18nService { | ||
|
||
/** | ||
* Loads the PHP translations from .mo files in the languages dir. | ||
* The .mo file must be named $domain-$locale.mo | ||
* | ||
* @param [string] $domain The text domain. | ||
* @param [string] $languages_dir The directory containing the .mo files. | ||
* @return boolean | ||
*/ | ||
public static function load_php_translations( $domain, $languages_dir ) { | ||
return load_plugin_textdomain( | ||
$domain, | ||
false, | ||
$languages_dir | ||
); | ||
} | ||
|
||
/** | ||
* Localizes a particular script using a JSON file present in the languages dir. | ||
* The JSON file must be named $domain-$locale-$script_slug.json. | ||
* Note: The script must be registered before this function is called. | ||
* | ||
* @param [string] $domain The text domain. | ||
* @param [string] $script_slug The slug of the registered script. | ||
* @param [string] $languages_dir The directory containing the .json file for the script. | ||
* @return boolean | ||
*/ | ||
public static function load_js_translations( $domain, $script_slug, $languages_dir ) { | ||
return wp_set_script_translations( | ||
$script_slug, | ||
$domain, | ||
$languages_dir | ||
); | ||
|
||
} | ||
} |
Oops, something went wrong.