diff options
Diffstat (limited to 'framework')
-rw-r--r-- | framework/I18N/TGlobalization.php | 7 | ||||
-rw-r--r-- | framework/I18N/Translation.php | 4 | ||||
-rw-r--r-- | framework/Web/THttpRequest.php | 5 | ||||
-rw-r--r-- | framework/Web/TUrlMapping.php | 39 |
4 files changed, 33 insertions, 22 deletions
diff --git a/framework/I18N/TGlobalization.php b/framework/I18N/TGlobalization.php index d3c6d233..90fd3d53 100644 --- a/framework/I18N/TGlobalization.php +++ b/framework/I18N/TGlobalization.php @@ -93,7 +93,7 @@ class TGlobalization extends TModule */
public function setDefaultCulture($culture)
{
- $this->_defaultCharset = str_replace('-','_',$culture);
+ $this->_defaultCulture = str_replace('-','_',$culture);
}
/**
@@ -160,6 +160,7 @@ class TGlobalization extends TModule * $config['catalogue'] = 'messages'; //default catalog
* $config['autosave'] = 'true'; //save untranslated message
* $config['cache'] = 'true'; //cache translated message
+ * $config['marker'] = '@@'; // surround untranslated text with '@@'
* </code>
* Throws exception is source is not found.
* @param TMap configuration options
@@ -176,7 +177,7 @@ class TGlobalization extends TModule if(@mkdir($config['source'])===false)
throw new TConfigurationException('globalization_source_path_failed',
$config['source']);
- chmod($config['source'], 0777); //make it deletable
+ chmod($config['source'], 0777); //make it deletable
}
}
else
@@ -192,7 +193,7 @@ class TGlobalization extends TModule if(@mkdir($config['cache'])===false)
throw new TConfigurationException('globalization_cache_path_failed',
$config['cache']);
- chmod($config['cache'], 0777); //make it deletable
+ chmod($config['cache'], 0777); //make it deletable
}
}
$this->_translation = $config;
diff --git a/framework/I18N/Translation.php b/framework/I18N/Translation.php index 33696304..7394842b 100644 --- a/framework/I18N/Translation.php +++ b/framework/I18N/Translation.php @@ -54,6 +54,10 @@ class Translation extends TComponent self::$formatter = new MessageFormat($source, $app->getCharset());
+ //mark untranslated text
+ if($ps=$config['marker'])
+ self::$formatter->setUntranslatedPS(array($ps,$ps));
+
//save the message on end request
Prado::getApplication()->attachEventHandler(
'OnEndRequest', array('Translation', 'saveMessages'));
diff --git a/framework/Web/THttpRequest.php b/framework/Web/THttpRequest.php index 33839ed0..aa690540 100644 --- a/framework/Web/THttpRequest.php +++ b/framework/Web/THttpRequest.php @@ -596,6 +596,11 @@ class THttpRequest extends TApplicationComponent implements IteratorAggregate,Ar }
}
+ protected function getRequestResolved()
+ {
+ return $this->_requestResolved;
+ }
+
/**
* @return array IDs of the available services
*/
diff --git a/framework/Web/TUrlMapping.php b/framework/Web/TUrlMapping.php index 3062b898..62656563 100644 --- a/framework/Web/TUrlMapping.php +++ b/framework/Web/TUrlMapping.php @@ -21,9 +21,9 @@ * The mapping format is as follows.
* <code>
* <module id="friendly-url" class="System.Web.TUrlMapping">
- * <url pageClass="Posts.ViewPost" pattern="post/{id}/?" parameters.id="\d+" />
- * <url pageClass="Posts.ListPost" pattern="archive/{time}/?" parameters.time="\d{6}" />
- * <url pageClass="Posts.ListPost" pattern="category/{cat}/?" parameters.cat="\d+" />
+ * <url ServiceParameter="Posts.ViewPost" pattern="post/{id}/?" parameters.id="\d+" />
+ * <url ServiceParameter="Posts.ListPost" pattern="archive/{time}/?" parameters.time="\d{6}" />
+ * <url ServiceParameter="Posts.ListPost" pattern="category/{cat}/?" parameters.cat="\d+" />
* </module>
* </code>
*
@@ -189,10 +189,10 @@ class TUrlMapping extends THttpRequest {
$request = $this->getRequest();
$id = $pattern->getServiceID();
- $page = $pattern->getPageClass();
+ $param = $pattern->getServiceParameter();
$request->setServiceID($id);
- $request->setServiceParameter($page);
- $request->add($id,$page);
+ $request->setServiceParameter($param);
+ $request->add($id,$param);
}
}
@@ -227,9 +227,10 @@ class TUrlMapping extends THttpRequest * The parameter values are available through the standard <tt>Request</tt>
* object. For example, <tt>$this->Request['year']</tt>.
*
- * The {@link setPageClass PageClass} and {@link setServiceID ServiceID}
- * (the default ID is 'page') set the class and the service that will
- * handle the matching URL.
+ * The {@link setServiceParameter ServiceParameter} and {@link setServiceID ServiceID}
+ * (the default ID is 'page') set the service parameter and service id respectively.
+ * The service parameter for the TPageService is the Page class name, other service
+ * may use the service parameter differently.
*
* For more complicated mappings, the body of the <tt><url></tt>
* can be used to specify the mapping pattern.
@@ -242,9 +243,9 @@ class TUrlMapping extends THttpRequest class TUrlMappingPattern extends TComponent
{
/**
- * @var string page class name.
+ * @var string service parameter such as Page class name.
*/
- private $_pageClass;
+ private $_serviceParameter;
/**
* @var string service ID, default is 'page'.
*/
@@ -277,10 +278,10 @@ class TUrlMappingPattern extends TComponent $body = trim($config->getValue());
if(strlen($body)>0)
$this->setPattern($body);
- if(is_null($this->_pageClass))
+ if(is_null($this->_serviceParameter))
{
throw new TConfigurationException(
- 'dispatcher_url_page_class_missing', $this->getPattern());
+ 'dispatcher_url_service_parameter_missing', $this->getPattern());
}
$this->initializePattern();
}
@@ -310,19 +311,19 @@ class TUrlMappingPattern extends TComponent }
/**
- * @param string name of the page class to handle the request.
+ * @param string service parameter, such as page class name.
*/
- public function setPageClass($value)
+ public function setServiceParameter($value)
{
- $this->_pageClass=$value;
+ $this->_serviceParameter=$value;
}
/**
- * @return string page class name.
+ * @return string service parameter, such as page class name.
*/
- public function getPageClass()
+ public function getServiceParameter()
{
- return $this->_pageClass;
+ return $this->_serviceParameter;
}
/**
|