forked from pi-engine/pi
-
Notifications
You must be signed in to change notification settings - Fork 0
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 #2 from pi-engine/master
update with Pi Master
- Loading branch information
Showing
91 changed files
with
1,860 additions
and
944 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,23 @@ | ||
# USING THE GIT REPOSITORY TO WORK ON PI ENGINE | ||
|
||
1. Setup a GitHub account (http://github.com/), if you haven't yet | ||
2. Clone the repo locally and enter it (use your own GitHub username | ||
in the statement below) | ||
Pi Engine Github Skeleton | ||
========================= | ||
|
||
```sh | ||
% git clone https://github.com/pi-engine/pi.git | ||
% cd pi | ||
``` | ||
Pi Engine Core | ||
---------------- | ||
* [pi-engine/pi](https://github.com/pi-engine/pi): Pi Engine core repo | ||
* [pi-engine/pi/wiki](https://github.com/pi-engine/pi/wiki): Pi Engine documents | ||
|
||
# GIT REPO SKELETON FOR PI ENGINE | ||
|
||
* [pi-engine/pi](https://github.com/pi-engine/pi): Pi Engine core repo | ||
* pi-engine/pi-{modulename}: repo for module {modulename}, for instance [pi-engine/pi-tag](https://github.com/pi-engine/pi-tag) for module tag | ||
* pi-engine/pi-theme-{themename}: repo for theme {themename}, for instance [pi-engine/pi-theme-pi](https://github.com/pi-engine/pi-theme-pi) for theme pi | ||
* pi-engine/{reponame}: repo for non-pi components | ||
Pi Engine Module | ||
---------------- | ||
* [pi-module](https://github.com/pi-module): repos for modules | ||
* Eeach module has its own repo, for instance [pi-module/tag](https://github.com/pi-module/tag) for module tag | ||
|
||
Pi Engine Theme | ||
--------------- | ||
* [pi-theme](https://github.com/pi-theme): repos for themes | ||
* Each theme has its ownrepo, for instance [pi-theme/pi](https://github.com/pi-theme/pi) for theme pi | ||
|
||
Pi Engine Extras | ||
---------------- | ||
* [pi-extra](https://github.com/pi-extra): repos for extra components |
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
Binary file not shown.
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,34 @@ | ||
<p> | ||
Pi Engine is a role oriented application development engine for web and mobile, designed as the next generation and a successor to Xoops. | ||
Pi is developed upon PHP and MySQL with selected third-party frameworks including but not limited to Zend Framework library, jQuery, Bootstrap and Backbone. | ||
</p> | ||
|
||
<p> | ||
Pi Project follows the philosophy of open standard, open design, open development and open structure. Pi is born as a complete open source project and intended to build a sustainable ecosystem that benefits all contributors and users. | ||
</p> | ||
|
||
<p> | ||
The Engine is released under a New BSD License. | ||
</p> | ||
|
||
<p> | ||
<ol> | ||
Selected features and practices: | ||
<li>Modularization for functionality and applications | ||
<li>Components for basic libraries and services for fundamental system functions | ||
<li>Theming for presentation and appearance | ||
<li>Design-friendly templating | ||
<li>DevOps oriented architecture | ||
<li>Centralized security enhancement | ||
<ol> | ||
</p> | ||
|
||
<p> | ||
<ul> | ||
Quick start: | ||
<li>Pi Engine website: <a href="http://pialog.org" title="Pi Engine">Pi Dialog</a> | ||
<li>Latest download: <a href="https://github.com/pi-engine/pi/zipball/master" title="Latest stable code">Stable Download</a> | ||
<li>Pi Engine documents: <a href="https://github.com/pi-engine/pi/wiki" title="Pi Wiki">Pi Documentation</a> | ||
<li>Feature and Issues: <a href="https://github.com/pi-engine/pi/issues" title="Issue Tracker">Pi Tracker</a> | ||
</ul> | ||
</p> |
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
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 |
---|---|---|
|
@@ -14,8 +14,6 @@ | |
* @author Taiwen Jiang <[email protected]> | ||
* @package Pi\Application | ||
* @subpackage Service | ||
* @since 3.0 | ||
* @version $Id$ | ||
*/ | ||
|
||
/** | ||
|
@@ -138,7 +136,35 @@ | |
* __('A test message', 'theme/default', 'en'); | ||
* </code> | ||
* | ||
* 7. Format a date | ||
* | ||
* 7. Register a message that will be translated in different lanauges, but not translated at the place where it is registered | ||
* <code> | ||
* _t('Message to be translated and used later.'); | ||
* </code> | ||
* // Use case, register module config | ||
* // Registered in a module's config.php | ||
* <code> | ||
* $config['key'] = array('title' => _t('Config Title'), 'description' => _t('Config hint'), '...')); | ||
* </code> | ||
* // Load translated message in the module config setting page | ||
* // module/system/src/Controller/Admin/ConfigController.php calls ConfigForm.php: | ||
* <code> | ||
* // Module\System\Form\ConfigForm::addElement() | ||
* | ||
* protected function addElement($config) | ||
* { | ||
* // ... | ||
* $attributes['description'] = __($config->description); | ||
* $options = array( | ||
* 'label' => __($config->title), | ||
* 'module' => $this->module, | ||
* ); | ||
* // ... | ||
* } | ||
* </code> | ||
* | ||
* | ||
* 8. Format a date | ||
* <code> | ||
* _date(time(), 'fa-IR', 'long', 'short', 'Asia/Tehran', 'persian'); | ||
* _date(time(), array('locale' => 'fa-IR', 'datetype' => 'long', 'timetype' => 'short', 'timezone' => 'Asia/Tehran', 'calendar' => 'persian')); | ||
|
@@ -167,22 +193,22 @@ | |
* _date(time(), ...); | ||
* </code> | ||
* | ||
* 8. Format a number | ||
* 9. Format a number | ||
* <code> | ||
* _number(123.4567, 'decimal', '#0.# kg', 'zh-CN', 'default'); | ||
* _number(123.4567, 'decimal', '#0.# kg', 'zh-CN'); | ||
* _number(123.4567, 'scientific'); | ||
* _number(123.4567, 'spellout'); | ||
* </code> | ||
* | ||
* 9. Format a currency | ||
* 10. Format a currency | ||
* <code> | ||
* _currency(123.45, 'USD', 'en-US'); | ||
* _currency(123.45, 'USD'); | ||
* _currency(123.45); | ||
* </code> | ||
* | ||
* 10. Get a date formatter | ||
* 11. Get a date formatter | ||
* <code> | ||
* Pi::service('i18n')->getDateFormatter('fa-IR', 'long', 'short', 'Asia/Tehran', 'persian'); | ||
* Pi::service('i18n')->getDateFormatter(array('locale' => 'fa-IR', 'datetype' => 'long', 'timetype' => 'short', 'timezone' => 'Asia/Tehran', 'calendar' => 'persian')); | ||
|
@@ -194,7 +220,7 @@ | |
* Pi::service('i18n')->getDateFormatter(array('pattern' => 'yyyy-MM-dd HH:mm:ss')); | ||
* </code> | ||
* | ||
* 11. Get a number formatter | ||
* 12. Get a number formatter | ||
* <code> | ||
* // Get a number formatter | ||
* Pi::service('i18n')->getNumberFormatter('decimal', '#0.# kg', 'zh-CN'); | ||
|
@@ -392,7 +418,7 @@ public function __get($name) | |
* Normalize domain in Intl resources, including Translator, Locale, Date, NumberFormatter, etc. | ||
* | ||
* @param string $domain | ||
* @return array pair of component and domain | ||
* @return array pair of component and domain | ||
*/ | ||
public function normalizeDomain($rawDomain) | ||
{ | ||
|
@@ -410,17 +436,19 @@ public function normalizeDomain($rawDomain) | |
* | ||
* @param array|string $domain | ||
* @param string|null $locale | ||
* @return Intl | ||
* @return I18n | ||
*/ | ||
public function load($domain, $locale = null) | ||
{ | ||
$domain = is_array($domain) ? $domain : $this->normalizeDomain($domain); | ||
$locale = $locale ?: $this->getLocale(); | ||
|
||
$this->getTranslator()->load($domain, $locale); | ||
$result = $this->getTranslator()->load($domain, $locale); | ||
|
||
if (Pi::service()->hasService('log')) { | ||
Pi::service()->getService('log')->info(sprintf('Translation "%s" is loaded', implode(':', $domain))); | ||
$message = $result | ||
? sprintf('Translation "%s.%s" is loaded.', implode(':', $domain), $locale) | ||
: sprintf('Translation "%s.%s" is empty.', implode(':', $domain), $locale); | ||
Pi::service()->getService('log')->info($message); | ||
} | ||
|
||
return $this; | ||
|
@@ -432,14 +460,14 @@ public function load($domain, $locale = null) | |
* @param string $domain | ||
* @param string $module | ||
* @param string $locale | ||
* @return Intl | ||
* @return I18n | ||
*/ | ||
public function loadModule($domain, $module = null, $locale = null) | ||
{ | ||
$module = $module ?: Pi::service('module')->current(); | ||
$component = array('module/' . $module, $domain); | ||
|
||
$this->load($component, $locale); | ||
|
||
return $this; | ||
} | ||
|
||
|
@@ -449,13 +477,14 @@ public function loadModule($domain, $module = null, $locale = null) | |
* @param string $domain | ||
* @param string $theme | ||
* @param string $locale | ||
* @return Intl | ||
* @return I18n | ||
*/ | ||
public function loadTheme($domain, $theme = null, $locale = null) | ||
{ | ||
$theme = $theme ?: Pi::service('theme')->current(); | ||
$component = array('theme/' . $theme, $domain); | ||
$this->load($component, $locale); | ||
|
||
return $this; | ||
} | ||
|
||
|
@@ -688,6 +717,18 @@ function _e($message, $domain = null, $locale = null) | |
echo __($message, $domain, $locale); | ||
} | ||
|
||
/** | ||
* Register a message to translation queue | ||
* | ||
* | ||
* @param string $message The string to be localized | ||
* @return void | ||
*/ | ||
function _t($message) | ||
{ | ||
return $message; | ||
} | ||
|
||
/** | ||
* Check if Intl functions are available | ||
*/ | ||
|
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
Oops, something went wrong.