';
86 |
87 | if ($e instanceof Bottle_Forbidden_Exception) {
88 | header("HTTP/1.0 403 Forbidden");
89 | } elseif ($e instanceof Bottle_NotFound_Exception) {
90 | header("HTTP/1.0 404 Not Found");
91 | } else {
92 | header("HTTP/1.0 500 Internal Server Error");
93 | }
94 | echo $html;
95 | }
96 |
97 | /**
98 | * Errors handler
99 | *
100 | * @param integer $errno
101 | * @param string $errstr
102 | * @param string $errfile
103 | * @param string $errline
104 | * @return void
105 | */
106 | public function errorHandler($errno, $errstr, $errfile, $errline) {
107 | $exception = new ErrorException($errstr, 0, $errno, $errfile, $errline);
108 | return $this->exceptionHandler($exception);
109 | }
110 |
111 | /**
112 | * Fatal error handler
113 | *
114 | * @todo некорректно работает - отстреливаются пред. обработчики
115 | * @return void
116 | */
117 | public function shutdownHandler() {
118 | $last_error = error_get_last();
119 | if ($last_error['type'] === E_ERROR OR $last_error['type'] === E_USER_ERROR) {
120 | ob_clean();
121 | $this->errorHandler(
122 | $last_error['type'],
123 | $last_error['message'],
124 | $last_error['file'],
125 | $last_error['line']
126 | );
127 | }
128 | }
129 |
130 | /**
131 | * Setting up global handlers
132 | *
133 | * @construct
134 | * @return void
135 | */
136 | public function __construct() {
137 | set_exception_handler(array($this, 'exceptionHandler'));
138 | set_error_handler(array($this, 'errorHandler'));
139 |
140 | register_shutdown_function(array($this, 'shutdownHandler'));
141 | spl_autoload_register(array($this, 'autoload'), TRUE, TRUE);
142 |
143 | Bottle_Core::start();
144 | }
145 | }
146 |
147 | // creating the global $request and $response objects
148 | $request = $response = null;
149 | new Bottle;
150 |
--------------------------------------------------------------------------------
/tests/classes/viewTest.php:
--------------------------------------------------------------------------------
1 |
11 | * @version 0.1
12 | * @license MIT
13 | */
14 | class ViewTest extends PHPUnit_Framework_TestCase
15 | {
16 | public function testCreate()
17 | {
18 | $view = new Bottle_View;
19 | $this->assertInstanceOf('Bottle_View', $view);
20 | }
21 |
22 | /**
23 | * @expectedException Bottle_Exception
24 | */
25 | public function testCreateWithNonexistingFilename()
26 | {
27 | $someFile = 'this-is-some-filename.txt';
28 | new Bottle_View($someFile);
29 | }
30 |
31 | public function testCreateWithExistingFilename()
32 | {
33 | $someFile = 'fixtures/views/simpleview.html';
34 | $view = new Bottle_View($someFile);
35 |
36 | $output = $view->render(true);
37 | $this->assertEquals($output, 'test');
38 | }
39 |
40 | /**
41 | * @expectedException Bottle_Exception
42 | */
43 | public function testSetFilenameWithNonexistingFilename()
44 | {
45 | $someFile = 'this-is-some-filename.txt';
46 | $view = new Bottle_View;
47 |
48 | $view->setFilename($someFile);
49 | }
50 |
51 | public function testSetFilenameWithExistingFilename()
52 | {
53 | $someFile = 'fixtures/views/simpleview.html';
54 | $view = new Bottle_View;
55 | $view->setFilename($someFile);
56 |
57 | $output = $view->render(true);
58 | $this->assertEquals($output, 'test');
59 | }
60 |
61 | public function testSetRoutes()
62 | {
63 | $data = [
64 | [null, []],
65 | [[], []],
66 | ['abcd', ['abcd']],
67 | [[1, 2, 3, 5], [1, 2, 3, 5]],
68 | [['a', 'b', 'c', 'd'], ['a', 'b', 'c', 'd']],
69 | ];
70 |
71 | $view = new Bottle_View;
72 | foreach ($data as $item) {
73 | list($src, $dest) = $item;
74 |
75 | $view->setRoutes($src);
76 | $this->assertEquals($dest, $view->routes);
77 | }
78 | }
79 |
80 | public function testBindAndRender()
81 | {
82 | $view = new Bottle_View;
83 |
84 | $data = [
85 | [
86 | 'fixtures/views/varview1.html',
87 | 'test',
88 | 'test',
89 | ],
90 | [
91 | 'fixtures/views/varview1.html',
92 | 'asd',
93 | 'asd',
94 | ],
95 | [
96 | 'fixtures/views/varview2.html',
97 | 'test',
98 | 'test:test:test',
99 | ],
100 | [
101 | 'fixtures/views/varview2.html',
102 | 'asd',
103 | 'test:asd:test',
104 | ],
105 | [
106 | 'fixtures/views/varview3.html',
107 | 'test',
108 | 'test:test',
109 | ],
110 | [
111 | 'fixtures/views/varview3.html',
112 | 'asd',
113 | 'asd:asd',
114 | ],
115 | ];
116 |
117 | foreach ($data as $item) {
118 | list($filename, $src, $dest) = $item;
119 |
120 | $view->setFilename($filename);
121 | $view->bind(['test' => $src]);
122 |
123 | $output = $view->render(true);
124 |
125 | $this->assertEquals($dest, $output);
126 | }
127 |
128 | $data = [
129 | [
130 | ['testOne' => 'asd', 'testTwo' => 'test'],
131 | 'asd:test',
132 | ],
133 | [
134 | ['testOne' => 'test', 'testTwo' => 'asd'],
135 | 'test:asd',
136 | ],
137 | ];
138 |
139 | $view->setFilename('fixtures/views/varview4.html');
140 | foreach ($data as $item) {
141 | list($vars, $dest) = $item;
142 | $view->bind($vars);
143 | $output = $view->render(true);
144 |
145 | $this->assertEquals($dest, $output);
146 | }
147 | }
148 |
149 | // /**
150 | // * @expectedException PHPUnit_Framework_Error
151 | // */
152 | // public function testNotDefinedVariables()
153 | // {
154 | // $view = new Bottle_View('fixtures/views/varview1.html');
155 | // $view->render(true);
156 | // }
157 |
158 | public function testUrl()
159 | {
160 | $data = [
161 | [null, null, '/'],
162 | ['main', [], '/'],
163 | ['asd', [], '/asd'],
164 | ['dummyMul', [], '/mul/42'],
165 | ['paramMul', ['num' => 42], '/mul/42'],
166 | ['restList', [], '/rest/data/:id'],
167 | ['restList', ['id' => null], '/rest/data'],
168 | ['restPage', ['id' => 12, 'page' => 1], '/rest/data/12/1'],
169 | ['restPage', ['id' => 12], '/rest/data/12/:page'],
170 | ['restPage', ['page' => 12], '/rest/data/:id/12'],
171 | ];
172 |
173 | $routes = [
174 | 'main' => '/',
175 | 'dummyMul' => '/mul/42',
176 | 'paramMul' => '/mul/:num',
177 | 'restList' => '/rest/data/:id',
178 | 'restPage' => '/rest/data/:id/:page',
179 | ];
180 |
181 | $view = new Bottle_View;
182 | $view->setRoutes($routes);
183 |
184 | foreach ($data as $item) {
185 | list($uri, $params, $dest) = $item;
186 | $url = $view->url($uri, $params);
187 |
188 | $this->assertEquals($dest, $url);
189 | }
190 | }
191 | }
--------------------------------------------------------------------------------
/src/bottle/response.php:
--------------------------------------------------------------------------------
1 | route !== NULL) {
38 | $controller = $request->route->getController();
39 | $parameters = $request->route->getParameters();
40 | $condition = $request->route->getCondition();
41 | if($condition) {
42 | // calling the condition function
43 | $result = $condition[0]($request, $condition[1]);
44 | if(!$result) {
45 | throw new Bottle_Forbidden_Exception('Forbidden');
46 | }
47 | }
48 |
49 | $body = $controller->invokeArgs($parameters);
50 |
51 | // if the controller returns an array, we try to call a
52 | // "global_context" function, which will add context to $body
53 | if(is_array($body)) {
54 | if(function_exists('global_context')) {
55 | $context = global_context($request);
56 | if(!is_array($context)) {
57 | throw new Bottle_Exception('global_context function must return an array');
58 | }
59 | $body = array_merge($context, $body);
60 | }
61 | }
62 |
63 | $this->setBody($body);
64 | } else {
65 | throw new Bottle_NotFound_Exception('No route found');
66 | }
67 |
68 | $this->send();
69 | }
70 |
71 | /**
72 | * Sets the response content
73 | *
74 | * @param string|array body
75 | * @return void
76 | */
77 | public function setBody($body) {
78 | $this->_body = $body;
79 | }
80 |
81 | /**
82 | * Adds data to content
83 | *
84 | * @param string $body
85 | * @return void
86 | */
87 | public function appendBody($body) {
88 | // todo: what if body is an array?
89 | $this->_body.= $body;
90 | }
91 |
92 | /**
93 | * Returns the response's content
94 | *
95 | * @return string|array
96 | */
97 | public function getBody() {
98 | return $this->_body;
99 | }
100 |
101 | /**
102 | * Sending the request to the client
103 | *
104 | * @return void
105 | */
106 | public function send() {
107 | // TODO: Caching
108 | foreach($this->_headers as $header_name => $header_value) {
109 | header($header_name.': '.$header_value);
110 | }
111 | if(!$this->_sendBody) {
112 | return;
113 | }
114 | // TODO: Response code treatment
115 | $body = $this->getBody();
116 | $view = $this->getView();
117 |
118 | // $body can be an array if the @view annotation is used
119 |
120 | if (is_array($body) AND $view !== NULL) {
121 | $view->bind($body);
122 | echo $view->render(TRUE);
123 | } else {
124 | echo $body;
125 | }
126 | }
127 |
128 | /**
129 | * Response view wrapper assignment
130 | *
131 | * @param Bottle_View $view
132 | * @return void
133 | */
134 | public function setView(Bottle_View $view) {
135 | $this->_view = $view;
136 | }
137 |
138 | /**
139 | * Getter for the response view wrapper
140 | *
141 | * @return Bottle_View
142 | */
143 | public function getView() {
144 | return $this->_view;
145 | }
146 |
147 | /**
148 | * Getter for all response headers
149 | *
150 | * @return array
151 | */
152 | public function getHeaders() {
153 | return $this->_headers;
154 | }
155 |
156 | /**
157 | * Getter for a single response header, returns false if it does not exist.
158 | *
159 | * @param string $header
160 | *
161 | * @return string|false
162 | */
163 | public function getHeader($header) {
164 | if(isset($this->_headers[$header])) {
165 | return $this->_headers[$header];
166 | } else {
167 | return false;
168 | }
169 | }
170 |
171 | /**
172 | * Setter for a response header.
173 | *
174 | * @param string $header the name of the header
175 | * @param string $value
176 | *
177 | */
178 | public function setHeader($header, $value) {
179 | $this->_headers[$header] = $value;
180 | }
181 |
182 | /**
183 | * delete a response header
184 | *
185 | * @param string $header
186 | */
187 | public function deleteHeader($header) {
188 | if(isset($this->_headers[$header])) {
189 | unset($this->_headers[$header]);
190 | }
191 | }
192 |
193 | /**
194 | * sends a Location header, redirecting to a given URL or route.
195 | *
196 | * @param array|string $location
197 | * @return null
198 | */
199 | public function redirect($location) {
200 | if(is_array($location)) {
201 | $url = $this->getView()->url($location[0], $location[1]);
202 | } elseif($location[0] != '/') {
203 | $url = $this->getView()->url($location);
204 | } else {
205 | $url = $location;
206 | }
207 | $this->setHeader('Location', $url);
208 | $this->_sendBody = false;
209 | return null;
210 | }
211 |
212 | }
213 |
--------------------------------------------------------------------------------
/src/bottle/request.php:
--------------------------------------------------------------------------------
1 | _docroot = $docroot;
58 | // truncating GET params
59 | $uri = substr(urldecode($_SERVER['REQUEST_URI']), strlen($docroot)-1);
60 | if(strpos($uri, '?') != false) {
61 | $uri = substr($uri, 0, strpos($uri, '?'));
62 | }
63 | $this->_uri = $uri;
64 | $this->_params = $_REQUEST;
65 |
66 | // getting request headers
67 | $this->headers = $this->parseHeaders($_SERVER);
68 | }
69 |
70 | /**
71 | * Current URL
72 | *
73 | * @return string
74 | */
75 | public function uri() {
76 | return $this->_uri;
77 | }
78 |
79 | /**
80 | * Setter for routing
81 | *
82 | * @param Bottle_Router $route
83 | * @return void
84 | */
85 | public function setRouter(Bottle_Route $route) {
86 | $this->route = $route;
87 | }
88 |
89 | /**
90 | * Getter for routing
91 | *
92 | * @return Bottle_Route
93 | */
94 | public function getRoute() {
95 | return $this->route;
96 | }
97 |
98 | /**
99 | * Getter for all GET/POST params
100 | *
101 | * @return array
102 | */
103 | public function getParams() {
104 | return $this->_params;
105 | }
106 |
107 | /**
108 | * Getter for one param, optionnally returning a given default value
109 | *
110 | * @param string $name
111 | * @param string $default optional
112 | * @return string|false false is returned if the param does not exists and
113 | * no default value is given
114 | */
115 | public function getParam($name, $default = false) {
116 | if(isset($this->_params[$name])) {
117 | return $this->_params[$name];
118 | } else {
119 | return $default;
120 | }
121 | }
122 |
123 | /**
124 | * getter for docroot, which is the URL prefix for Bottle
125 | *
126 | * @return string
127 | */
128 | public function getDocroot() {
129 | return $this->_docroot;
130 | }
131 |
132 | /**
133 | * Request headers parser
134 | * Returns an associative array of the headers found in $_SERVER, in
135 | * (normally) correct case.
136 | *
137 | * The original function is found here:
138 | * http://us2.php.net/manual/fr/function.apache-request-headers.php#70810
139 | *
140 | * @param array $server
141 | * @return array
142 | */
143 | protected function parseHeaders($server) {
144 | $arh = array();
145 | $rx_http = '/\AHTTP_/';
146 | foreach($server as $key => $val) {
147 | if( preg_match($rx_http, $key) ) {
148 | $arh_key = preg_replace($rx_http, '', $key);
149 | $rx_matches = array();
150 | // do some nasty string manipulations to restore the original letter case
151 | // this should work in most cases
152 | $rx_matches = explode('_', $arh_key);
153 | if( count($rx_matches) > 0 and strlen($arh_key) > 2 ) {
154 | foreach($rx_matches as $ak_key => $ak_val) {
155 | $rx_matches[$ak_key] = ucfirst(strtolower($ak_val));
156 | }
157 | $arh_key = implode('-', $rx_matches);
158 |
159 | // exception for the DNT header, which must stay uppercase
160 | if($arh_key == 'Dnt') {
161 | $arh_key = strtoupper($arh_key);
162 | }
163 |
164 | }
165 |
166 | $arh[$arh_key] = $val;
167 | }
168 | }
169 | return( $arh );
170 | }
171 |
172 | /**
173 | * getter for all headers
174 | *
175 | * @return array
176 | */
177 | public function getHeaders(){
178 | return $this->headers;
179 | }
180 |
181 |
182 | /**
183 | * getter for a given header
184 | *
185 | * @param string $header_name
186 | * @return string|null
187 | */
188 | public function getHeader($header_name) {
189 | if(isset($this->headers[$header_name])) {
190 | return $this->headers[$header_name];
191 | } else {
192 | return null;
193 | }
194 | }
195 |
196 | /**
197 | * helper method to know if we’re on an AJAX request
198 | *
199 | * @return bool
200 | */
201 | public function isAjax(){
202 | return $this->getHeader('X-Requested-With') == 'XMLHttpRequest';
203 | }
204 | }
205 |
--------------------------------------------------------------------------------
/docs/_exts/sensio/sphinx/phpcode.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | """
3 | :copyright: (c) 2010-2012 Fabien Potencier
4 | :license: MIT, see LICENSE for more details.
5 | """
6 |
7 | import re
8 |
9 | from docutils import nodes, utils
10 |
11 | from sphinx.util.nodes import split_explicit_title
12 |
13 | def php_namespace_role(typ, rawtext, text, lineno, inliner, options={}, content=[]):
14 | text = utils.unescape(text)
15 | env = inliner.document.settings.env
16 | has_explicit_title, title, namespace = split_explicit_title(text)
17 |
18 | if len(re.findall(r'[^\\]\\[^\\]', rawtext)) > 0:
19 | env.warn(env.docname, 'backslash not escaped in %s' % rawtext, lineno)
20 |
21 | full_url = build_url('namespace', namespace, None, None, inliner)
22 |
23 | if not has_explicit_title:
24 | name = namespace.lstrip('\\')
25 | ns = name.rfind('\\')
26 | if ns != -1:
27 | name = name[ns+1:]
28 | title = name
29 | list = [nodes.reference(title, title, internal=False, refuri=full_url, reftitle=namespace)]
30 | pnode = nodes.literal('', '', *list)
31 | return [pnode], []
32 |
33 | def php_class_role(typ, rawtext, text, lineno, inliner, options={}, content=[]):
34 | text = utils.unescape(text)
35 | env = inliner.document.settings.env
36 | has_explicit_title, title, full_class = split_explicit_title(text)
37 | backslash = full_class.rfind('\\')
38 | namespace = full_class[:backslash]
39 | class_name = full_class[backslash+1:]
40 |
41 | if len(re.findall(r'[^\\]\\[^\\]', rawtext)) > 0:
42 | env.warn(env.docname, 'backslash not escaped in %s' % rawtext, lineno)
43 |
44 | full_url = build_url('class', namespace, class_name, None, inliner)
45 |
46 | if not has_explicit_title:
47 | class_name = full_class.lstrip('\\')
48 | ns = class_name.rfind('\\')
49 | if ns != -1:
50 | class_name = class_name[ns+1:]
51 | title = class_name
52 | list = [nodes.reference(title, title, internal=False, refuri=full_url, reftitle=full_class)]
53 | pnode = nodes.literal('', '', *list)
54 | return [pnode], []
55 |
56 | def php_method_role(typ, rawtext, text, lineno, inliner, options={}, content=[]):
57 | text = utils.unescape(text)
58 | env = inliner.document.settings.env
59 | has_explicit_title, title, class_and_method = split_explicit_title(text)
60 |
61 | ns = class_and_method.rfind('::')
62 | full_class = class_and_method[:ns]
63 | method = class_and_method[ns+2:]
64 | backslash = full_class.rfind('\\')
65 | namespace = full_class[:backslash]
66 | class_name = full_class[backslash+1:]
67 |
68 | if len(re.findall(r'[^\\]\\[^\\]', rawtext)) > 0:
69 | env.warn(env.docname, 'backslash not escaped in %s' % rawtext, lineno)
70 |
71 | full_url = build_url('method', namespace, class_name, method, inliner)
72 |
73 | if not has_explicit_title:
74 | title = method + '()'
75 | list = [nodes.reference(title, title, internal=False, refuri=full_url, reftitle=full_class + '::' + method + '()')]
76 | pnode = nodes.literal('', '', *list)
77 | return [pnode], []
78 |
79 | def php_phpclass_role(typ, rawtext, text, lineno, inliner, options={}, content=[]):
80 | text = utils.unescape(text)
81 | has_explicit_title, title, full_class = split_explicit_title(text)
82 |
83 | full_url = 'http://php.net/manual/en/class.%s.php' % full_class.lower()
84 |
85 | if not has_explicit_title:
86 | title = full_class
87 | list = [nodes.reference(title, title, internal=False, refuri=full_url, reftitle=full_class)]
88 | pnode = nodes.literal('', '', *list)
89 | return [pnode], []
90 |
91 | def php_phpmethod_role(typ, rawtext, text, lineno, inliner, options={}, content=[]):
92 | text = utils.unescape(text)
93 | has_explicit_title, title, class_and_method = split_explicit_title(text)
94 |
95 | ns = class_and_method.rfind('::')
96 | full_class = class_and_method[:ns]
97 | method = class_and_method[ns+2:]
98 |
99 | full_url = 'http://php.net/manual/en/%s.%s.php' % (full_class.lower(), method.lower())
100 |
101 | if not has_explicit_title:
102 | title = full_class + '::' + method + '()'
103 | list = [nodes.reference(title, title, internal=False, refuri=full_url, reftitle=full_class)]
104 | pnode = nodes.literal('', '', *list)
105 | return [pnode], []
106 |
107 | def php_phpfunction_role(typ, rawtext, text, lineno, inliner, options={}, content=[]):
108 | text = utils.unescape(text)
109 | has_explicit_title, title, full_function = split_explicit_title(text)
110 |
111 | full_url = 'http://php.net/manual/en/function.%s.php' % full_function.replace('_', '-').lower()
112 |
113 | if not has_explicit_title:
114 | title = full_function
115 | list = [nodes.reference(title, title, internal=False, refuri=full_url, reftitle=full_function)]
116 | pnode = nodes.literal('', '', *list)
117 | return [pnode], []
118 |
119 | def setup(app):
120 | app.add_config_value('api_url', {}, 'env')
121 | app.add_config_value('api_url_pattern', None, 'env')
122 | app.add_config_value('namespace_separator', '/', 'env')
123 | app.add_role('namespace', php_namespace_role)
124 | app.add_role('class', php_class_role)
125 | app.add_role('method', php_method_role)
126 | app.add_role('phpclass', php_phpclass_role)
127 | app.add_role('phpmethod', php_phpmethod_role)
128 | app.add_role('phpfunction', php_phpfunction_role)
129 |
130 | def build_url(role, namespace, class_name, method, inliner):
131 | env = inliner.document.settings.env
132 |
133 | if namespace is None:
134 | namespace = ''
135 | if class_name is None:
136 | class_name = ''
137 | if method is None:
138 | method = ''
139 |
140 | if ('namespace_separator' in env.app.config):
141 | namespace = namespace.replace('\\', env.app.config.namespace_separator)
142 | else:
143 | namespace = namespace.replace('\\', '/')
144 |
145 | if (env.app.config.api_url_pattern is None):
146 | fqcn = '%(namespace)s{class}/%(class)s{/class}{method}/%(class)s{/method}'
147 | api_url_pattern = env.app.config.api_url.replace('%s', fqcn)
148 | api_url_pattern += '.html{method}#method_%(method)s{/method}'
149 | else:
150 | api_url_pattern = str(env.app.config.api_url_pattern)
151 |
152 | api_url_pattern = api_url_pattern.replace('{'+role+'}', '')
153 | api_url_pattern = api_url_pattern.replace('{/'+role+'}', '')
154 |
155 | for unused_role in ('namespace', 'class', 'method'):
156 | api_url_pattern = re.sub(r'{'+unused_role+'}.*?{/'+unused_role+'}', '', api_url_pattern)
157 |
158 | try:
159 | full_url = api_url_pattern % {'namespace': namespace, 'class': class_name, 'method': method}
160 | except (TypeError, ValueError):
161 | env.warn(env.docname, 'unable to expand %s api_url with base '
162 | 'URL %r, please make sure the base contains \'%%s\' '
163 | 'exactly once' % (role, api_url_pattern))
164 | full_url = api_url_pattern + full_class
165 |
166 | return full_url
167 |
--------------------------------------------------------------------------------
/docs/Makefile:
--------------------------------------------------------------------------------
1 | # Makefile for Sphinx documentation
2 | #
3 |
4 | # You can set these variables from the command line.
5 | SPHINXOPTS =
6 | SPHINXBUILD = sphinx-build
7 | PAPER =
8 | BUILDDIR = _build
9 |
10 | # User-friendly check for sphinx-build
11 | ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1)
12 | $(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/)
13 | endif
14 |
15 | # Internal variables.
16 | PAPEROPT_a4 = -D latex_paper_size=a4
17 | PAPEROPT_letter = -D latex_paper_size=letter
18 | ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
19 | # the i18n builder cannot share the environment and doctrees with the others
20 | I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
21 |
22 | .PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext
23 |
24 | help:
25 | @echo "Please use \`make ' where is one of"
26 | @echo " html to make standalone HTML files"
27 | @echo " dirhtml to make HTML files named index.html in directories"
28 | @echo " singlehtml to make a single large HTML file"
29 | @echo " pickle to make pickle files"
30 | @echo " json to make JSON files"
31 | @echo " htmlhelp to make HTML files and a HTML help project"
32 | @echo " qthelp to make HTML files and a qthelp project"
33 | @echo " devhelp to make HTML files and a Devhelp project"
34 | @echo " epub to make an epub"
35 | @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
36 | @echo " latexpdf to make LaTeX files and run them through pdflatex"
37 | @echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx"
38 | @echo " text to make text files"
39 | @echo " man to make manual pages"
40 | @echo " texinfo to make Texinfo files"
41 | @echo " info to make Texinfo files and run them through makeinfo"
42 | @echo " gettext to make PO message catalogs"
43 | @echo " changes to make an overview of all changed/added/deprecated items"
44 | @echo " xml to make Docutils-native XML files"
45 | @echo " pseudoxml to make pseudoxml-XML files for display purposes"
46 | @echo " linkcheck to check all external links for integrity"
47 | @echo " doctest to run all doctests embedded in the documentation (if enabled)"
48 |
49 | clean:
50 | rm -rf $(BUILDDIR)/*
51 |
52 | html:
53 | $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
54 | @echo
55 | @echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
56 |
57 | dirhtml:
58 | $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
59 | @echo
60 | @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
61 |
62 | singlehtml:
63 | $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
64 | @echo
65 | @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
66 |
67 | pickle:
68 | $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
69 | @echo
70 | @echo "Build finished; now you can process the pickle files."
71 |
72 | json:
73 | $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
74 | @echo
75 | @echo "Build finished; now you can process the JSON files."
76 |
77 | htmlhelp:
78 | $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
79 | @echo
80 | @echo "Build finished; now you can run HTML Help Workshop with the" \
81 | ".hhp project file in $(BUILDDIR)/htmlhelp."
82 |
83 | qthelp:
84 | $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
85 | @echo
86 | @echo "Build finished; now you can run "qcollectiongenerator" with the" \
87 | ".qhcp project file in $(BUILDDIR)/qthelp, like this:"
88 | @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/PHP-Bottle.qhcp"
89 | @echo "To view the help file:"
90 | @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/PHP-Bottle.qhc"
91 |
92 | devhelp:
93 | $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
94 | @echo
95 | @echo "Build finished."
96 | @echo "To view the help file:"
97 | @echo "# mkdir -p $$HOME/.local/share/devhelp/PHP-Bottle"
98 | @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/PHP-Bottle"
99 | @echo "# devhelp"
100 |
101 | epub:
102 | $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
103 | @echo
104 | @echo "Build finished. The epub file is in $(BUILDDIR)/epub."
105 |
106 | latex:
107 | $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
108 | @echo
109 | @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
110 | @echo "Run \`make' in that directory to run these through (pdf)latex" \
111 | "(use \`make latexpdf' here to do that automatically)."
112 |
113 | latexpdf:
114 | $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
115 | @echo "Running LaTeX files through pdflatex..."
116 | $(MAKE) -C $(BUILDDIR)/latex all-pdf
117 | @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
118 |
119 | latexpdfja:
120 | $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
121 | @echo "Running LaTeX files through platex and dvipdfmx..."
122 | $(MAKE) -C $(BUILDDIR)/latex all-pdf-ja
123 | @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
124 |
125 | text:
126 | $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
127 | @echo
128 | @echo "Build finished. The text files are in $(BUILDDIR)/text."
129 |
130 | man:
131 | $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
132 | @echo
133 | @echo "Build finished. The manual pages are in $(BUILDDIR)/man."
134 |
135 | texinfo:
136 | $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
137 | @echo
138 | @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
139 | @echo "Run \`make' in that directory to run these through makeinfo" \
140 | "(use \`make info' here to do that automatically)."
141 |
142 | info:
143 | $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
144 | @echo "Running Texinfo files through makeinfo..."
145 | make -C $(BUILDDIR)/texinfo info
146 | @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
147 |
148 | gettext:
149 | $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
150 | @echo
151 | @echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."
152 |
153 | changes:
154 | $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
155 | @echo
156 | @echo "The overview file is in $(BUILDDIR)/changes."
157 |
158 | linkcheck:
159 | $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
160 | @echo
161 | @echo "Link check complete; look for any errors in the above output " \
162 | "or in $(BUILDDIR)/linkcheck/output.txt."
163 |
164 | doctest:
165 | $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
166 | @echo "Testing of doctests in the sources finished, look at the " \
167 | "results in $(BUILDDIR)/doctest/output.txt."
168 |
169 | xml:
170 | $(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml
171 | @echo
172 | @echo "Build finished. The XML files are in $(BUILDDIR)/xml."
173 |
174 | pseudoxml:
175 | $(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml
176 | @echo
177 | @echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml."
178 |
--------------------------------------------------------------------------------
/docs/make.bat:
--------------------------------------------------------------------------------
1 | @ECHO OFF
2 |
3 | REM Command file for Sphinx documentation
4 |
5 | if "%SPHINXBUILD%" == "" (
6 | set SPHINXBUILD=sphinx-build
7 | )
8 | set BUILDDIR=_build
9 | set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% .
10 | set I18NSPHINXOPTS=%SPHINXOPTS% .
11 | if NOT "%PAPER%" == "" (
12 | set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS%
13 | set I18NSPHINXOPTS=-D latex_paper_size=%PAPER% %I18NSPHINXOPTS%
14 | )
15 |
16 | if "%1" == "" goto help
17 |
18 | if "%1" == "help" (
19 | :help
20 | echo.Please use `make ^` where ^ is one of
21 | echo. html to make standalone HTML files
22 | echo. dirhtml to make HTML files named index.html in directories
23 | echo. singlehtml to make a single large HTML file
24 | echo. pickle to make pickle files
25 | echo. json to make JSON files
26 | echo. htmlhelp to make HTML files and a HTML help project
27 | echo. qthelp to make HTML files and a qthelp project
28 | echo. devhelp to make HTML files and a Devhelp project
29 | echo. epub to make an epub
30 | echo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter
31 | echo. text to make text files
32 | echo. man to make manual pages
33 | echo. texinfo to make Texinfo files
34 | echo. gettext to make PO message catalogs
35 | echo. changes to make an overview over all changed/added/deprecated items
36 | echo. xml to make Docutils-native XML files
37 | echo. pseudoxml to make pseudoxml-XML files for display purposes
38 | echo. linkcheck to check all external links for integrity
39 | echo. doctest to run all doctests embedded in the documentation if enabled
40 | goto end
41 | )
42 |
43 | if "%1" == "clean" (
44 | for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i
45 | del /q /s %BUILDDIR%\*
46 | goto end
47 | )
48 |
49 |
50 | %SPHINXBUILD% 2> nul
51 | if errorlevel 9009 (
52 | echo.
53 | echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
54 | echo.installed, then set the SPHINXBUILD environment variable to point
55 | echo.to the full path of the 'sphinx-build' executable. Alternatively you
56 | echo.may add the Sphinx directory to PATH.
57 | echo.
58 | echo.If you don't have Sphinx installed, grab it from
59 | echo.http://sphinx-doc.org/
60 | exit /b 1
61 | )
62 |
63 | if "%1" == "html" (
64 | %SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html
65 | if errorlevel 1 exit /b 1
66 | echo.
67 | echo.Build finished. The HTML pages are in %BUILDDIR%/html.
68 | goto end
69 | )
70 |
71 | if "%1" == "dirhtml" (
72 | %SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml
73 | if errorlevel 1 exit /b 1
74 | echo.
75 | echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml.
76 | goto end
77 | )
78 |
79 | if "%1" == "singlehtml" (
80 | %SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml
81 | if errorlevel 1 exit /b 1
82 | echo.
83 | echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml.
84 | goto end
85 | )
86 |
87 | if "%1" == "pickle" (
88 | %SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle
89 | if errorlevel 1 exit /b 1
90 | echo.
91 | echo.Build finished; now you can process the pickle files.
92 | goto end
93 | )
94 |
95 | if "%1" == "json" (
96 | %SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json
97 | if errorlevel 1 exit /b 1
98 | echo.
99 | echo.Build finished; now you can process the JSON files.
100 | goto end
101 | )
102 |
103 | if "%1" == "htmlhelp" (
104 | %SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp
105 | if errorlevel 1 exit /b 1
106 | echo.
107 | echo.Build finished; now you can run HTML Help Workshop with the ^
108 | .hhp project file in %BUILDDIR%/htmlhelp.
109 | goto end
110 | )
111 |
112 | if "%1" == "qthelp" (
113 | %SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp
114 | if errorlevel 1 exit /b 1
115 | echo.
116 | echo.Build finished; now you can run "qcollectiongenerator" with the ^
117 | .qhcp project file in %BUILDDIR%/qthelp, like this:
118 | echo.^> qcollectiongenerator %BUILDDIR%\qthelp\PHP-Bottle.qhcp
119 | echo.To view the help file:
120 | echo.^> assistant -collectionFile %BUILDDIR%\qthelp\PHP-Bottle.ghc
121 | goto end
122 | )
123 |
124 | if "%1" == "devhelp" (
125 | %SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp
126 | if errorlevel 1 exit /b 1
127 | echo.
128 | echo.Build finished.
129 | goto end
130 | )
131 |
132 | if "%1" == "epub" (
133 | %SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub
134 | if errorlevel 1 exit /b 1
135 | echo.
136 | echo.Build finished. The epub file is in %BUILDDIR%/epub.
137 | goto end
138 | )
139 |
140 | if "%1" == "latex" (
141 | %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
142 | if errorlevel 1 exit /b 1
143 | echo.
144 | echo.Build finished; the LaTeX files are in %BUILDDIR%/latex.
145 | goto end
146 | )
147 |
148 | if "%1" == "latexpdf" (
149 | %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
150 | cd %BUILDDIR%/latex
151 | make all-pdf
152 | cd %BUILDDIR%/..
153 | echo.
154 | echo.Build finished; the PDF files are in %BUILDDIR%/latex.
155 | goto end
156 | )
157 |
158 | if "%1" == "latexpdfja" (
159 | %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
160 | cd %BUILDDIR%/latex
161 | make all-pdf-ja
162 | cd %BUILDDIR%/..
163 | echo.
164 | echo.Build finished; the PDF files are in %BUILDDIR%/latex.
165 | goto end
166 | )
167 |
168 | if "%1" == "text" (
169 | %SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text
170 | if errorlevel 1 exit /b 1
171 | echo.
172 | echo.Build finished. The text files are in %BUILDDIR%/text.
173 | goto end
174 | )
175 |
176 | if "%1" == "man" (
177 | %SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man
178 | if errorlevel 1 exit /b 1
179 | echo.
180 | echo.Build finished. The manual pages are in %BUILDDIR%/man.
181 | goto end
182 | )
183 |
184 | if "%1" == "texinfo" (
185 | %SPHINXBUILD% -b texinfo %ALLSPHINXOPTS% %BUILDDIR%/texinfo
186 | if errorlevel 1 exit /b 1
187 | echo.
188 | echo.Build finished. The Texinfo files are in %BUILDDIR%/texinfo.
189 | goto end
190 | )
191 |
192 | if "%1" == "gettext" (
193 | %SPHINXBUILD% -b gettext %I18NSPHINXOPTS% %BUILDDIR%/locale
194 | if errorlevel 1 exit /b 1
195 | echo.
196 | echo.Build finished. The message catalogs are in %BUILDDIR%/locale.
197 | goto end
198 | )
199 |
200 | if "%1" == "changes" (
201 | %SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes
202 | if errorlevel 1 exit /b 1
203 | echo.
204 | echo.The overview file is in %BUILDDIR%/changes.
205 | goto end
206 | )
207 |
208 | if "%1" == "linkcheck" (
209 | %SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck
210 | if errorlevel 1 exit /b 1
211 | echo.
212 | echo.Link check complete; look for any errors in the above output ^
213 | or in %BUILDDIR%/linkcheck/output.txt.
214 | goto end
215 | )
216 |
217 | if "%1" == "doctest" (
218 | %SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest
219 | if errorlevel 1 exit /b 1
220 | echo.
221 | echo.Testing of doctests in the sources finished, look at the ^
222 | results in %BUILDDIR%/doctest/output.txt.
223 | goto end
224 | )
225 |
226 | if "%1" == "xml" (
227 | %SPHINXBUILD% -b xml %ALLSPHINXOPTS% %BUILDDIR%/xml
228 | if errorlevel 1 exit /b 1
229 | echo.
230 | echo.Build finished. The XML files are in %BUILDDIR%/xml.
231 | goto end
232 | )
233 |
234 | if "%1" == "pseudoxml" (
235 | %SPHINXBUILD% -b pseudoxml %ALLSPHINXOPTS% %BUILDDIR%/pseudoxml
236 | if errorlevel 1 exit /b 1
237 | echo.
238 | echo.Build finished. The pseudo-XML files are in %BUILDDIR%/pseudoxml.
239 | goto end
240 | )
241 |
242 | :end
243 |
--------------------------------------------------------------------------------
/docs/locale/fr/LC_MESSAGES/contributing.po:
--------------------------------------------------------------------------------
1 | #
2 | msgid ""
3 | msgstr ""
4 | "Project-Id-Version: PHP-Bottle 0.1.0\n"
5 | "Report-Msgid-Bugs-To: \n"
6 | "POT-Creation-Date: 2015-03-10 11:44+0100\n"
7 | "PO-Revision-Date: 2015-03-10 11:59+0100\n"
8 | "Last-Translator: Damien Nicolas \n"
9 | "Language-Team: PHP-Bottle \n"
10 | "MIME-Version: 1.0\n"
11 | "Content-Type: text/plain; charset=UTF-8\n"
12 | "Content-Transfer-Encoding: 8bit\n"
13 | "Language: fr\n"
14 | "X-Generator: Poedit 1.5.5\n"
15 |
16 | #: ../../contributing.rst:2
17 | msgid "Contributing to PHP-Bottle"
18 | msgstr "Contribuer à PHP-Bottle"
19 |
20 | #: ../../contributing.rst:4
21 | msgid ""
22 | "As a free software, PHP-Bottle depends on you to be a living project in "
23 | "order to help developers."
24 | msgstr ""
25 | "En tant que logiciel libre, PHP-Bottle dépend de vous pour vivre et parvenir "
26 | "à son but d’aider les développeurs."
27 |
28 | #: ../../contributing.rst:7
29 | msgid ""
30 | "PHP-Bottle is currently a tiny baby project, and does not have a dedicated "
31 | "website yet. Still, you can use this documentation site to learn how to use "
32 | "it and how to make it better."
33 | msgstr ""
34 | "PHP-Bottle est encore un tout petit projet, et ne bénéficie pas encore d’un "
35 | "site web. Néanmoins, vous pouvez utiliser cette documentation pour apprendre "
36 | "à l’utiliser et l’améliorer."
37 |
38 | #: ../../contributing.rst:13
39 | msgid "Get the Sources"
40 | msgstr "Obtenir les sources"
41 |
42 | #: ../../contributing.rst:15
43 | msgid ""
44 | "The PHP-Bottle `development repository`_ and the `issue tracker`_ are both "
45 | "hosted at Github. If you plan to contribute, it is a good idea to create an "
46 | "account there and fork the main repository. This way your changes and ideas "
47 | "are visible to other developers and can be discussed openly. Even without an "
48 | "account, you can clone the repository or just download the latest "
49 | "development version as a source archive."
50 | msgstr ""
51 | "Le `dépôt de travail`_ et le `gestionnaire de tickets`_ sont tous deux "
52 | "hébergés sur Github. Si vous souhaitez contribuer, c’est une bonne idée d’y "
53 | "créer un compte et de forker le dépôt principal. De cette façon, vos "
54 | "modifications seront visibles aux autres développeurs et pourront être "
55 | "discutées publiquement. Même sans compte, vous pouvez cloner le dépôt, ou "
56 | "simplement télécharger l’archive de la dernière version."
57 |
58 | #: ../../contributing.rst:22
59 | msgid "git: git clone git://github.com/nergal/php-bottle.git"
60 | msgstr "git: git clone git://github.com/nergal/php-bottle.git"
61 |
62 | #: ../../contributing.rst:23
63 | msgid "git/https: git clone https://github.com/nergal/php-bottle.git"
64 | msgstr "git/https: git clone https://github.com/nergal/php-bottle.git"
65 |
66 | #: ../../contributing.rst:24
67 | msgid "Download: `Development branch`_ as tar archive or zip file."
68 | msgstr "Download: `Development branch`_ as tar archive or zip file."
69 |
70 | #: ../../contributing.rst:34
71 | msgid "Submitting Patches"
72 | msgstr "Soumettre des patches"
73 |
74 | #: ../../contributing.rst:36
75 | msgid ""
76 | "The best way to get your changes integrated into the main development branch "
77 | "is to fork the main repository at Github, create a new feature-branch, apply "
78 | "your changes and send a pull-request. Further down this page is a small "
79 | "collection of git workflow examples that may guide you. In any case, please "
80 | "follow some basic rules:"
81 | msgstr ""
82 | "La meilleure façon de voir vos changement intégrés dans la branche de "
83 | "développement principale est de forker le dépôt principal sur Github, créer "
84 | "une nouvelle branche liée à une fonctionnalité, et d’envoyer une pull-"
85 | "request. Vous trouverez des exemples de *workflows* Git qui pourraient vous "
86 | "aider, plus bas dans cette page. Dans tous les cas, veuillez respecter ces "
87 | "règles basiques :"
88 |
89 | #: ../../contributing.rst:42
90 | msgid ""
91 | "**Documentation**: Tell us what your patch does. Comment your code. If you "
92 | "introduced a new feature, add to the documentation so others can learn about "
93 | "it."
94 | msgstr ""
95 | "**Documentation** : indiquez ce que fait votre patch. Commentez votre code. "
96 | "Si vous introduisez une nouvelle fonctionnalité, ajoutez-la à la "
97 | "documentation afin que d’autres puissent apprendre son fonctionnement."
98 |
99 | #: ../../contributing.rst:45
100 | msgid ""
101 | "**Test**: Write tests to prove that your code works as expected and does not "
102 | "break anything. If you fixed a bug, write at least one test-case that "
103 | "triggers the bug. Make sure that all tests pass before you submit a patch."
104 | msgstr ""
105 | "**Tests** : écrivez des tests pour prouver que votre code fonctionne comme "
106 | "prévu et ne casse rien. Si vous avez corrigé un bug, écrivez au moins un "
107 | "test traitant le cas de figure qui provoquait le bug. Assurez-vous que tous "
108 | "les tests passent avant de soumettre un patche."
109 |
110 | #: ../../contributing.rst:48
111 | msgid ""
112 | "**One patch at a time**: Only fix one bug or add one feature at a time. "
113 | "Design your patches so that they can be applyed as a whole. Keep your "
114 | "patches clean, small and focused. Sync with upstream: If the upstream/"
115 | "master branch changed while you were working on your patch, rebase or pull "
116 | "to make sure that your patch still applies without conflicts."
117 | msgstr ""
118 | "**Un patch à la fois** : ne corrigez qu’un bug, ou n’ajoutez qu’une "
119 | "fonctionnalité, à la fois. Concevez vous patches pour qu’ils puissent être "
120 | "appliqués comme un tout. Maintenez leur code propre, succint et concentré "
121 | "sur l’essentiel. Soyez à jour par rapport à l’upstream : si la branche "
122 | "upstream/master change alors que vous travailliez sur votre patch, faites un "
123 | "*rebase* ou un *pull* pour vous assurez que votre patch s’applique toujours "
124 | "sans conflits."
125 |
126 | #: ../../contributing.rst:55
127 | msgid "Building the Documentation"
128 | msgstr "Construire la Documentation"
129 |
130 | #: ../../contributing.rst:57
131 | msgid ""
132 | "You need a recent version of `Sphinx`_ to build the documentation. The "
133 | "recommended way is to install **virtualenv** using your distribution package "
134 | "repository and install sphinx manually to get an up-to-date version."
135 | msgstr ""
136 | "Il vous faut une version récente de `Sphinx`_ pour construire la "
137 | "documentation. Nous vous recommandons d’installer **Virtualenv** via le "
138 | "gestionnaire de paquets de votre distribution, et d’installer Sphinx ensuite "
139 | "pour bénéficier d’une version à jour."
140 |
141 | #: ../../contributing.rst:80
142 | msgid ""
143 | "Now, for convenience, you can move to the *_build/html* folder, and run a "
144 | "development server:"
145 | msgstr ""
146 | "Maintenant, pour plus de praticité, vous pouvez vous déplacer dans le "
147 | "dossier *_build/html*, et lancer un serveur de développement."
148 |
149 | #: ../../contributing.rst:87
150 | msgid "Then open a web browser to http://localhost:8000 ."
151 | msgstr ""
152 | "Maintenant, ouvrez un navigateur web, et faites-le pointer sur http://"
153 | "localhost:8000 ."
154 |
155 | #: ../../contributing.rst:89
156 | msgid ""
157 | "This documentation is multilingual, so you can also work on translations. "
158 | "You will need Poedit_ or any software that can edit .po files."
159 | msgstr ""
160 | "Cette documentation est multilingue, donc vous pouvez également travailler "
161 | "sur les traductions. Vous aurez besoin pour cela de Poedit_, ou de tout "
162 | "logiciel capable d’éditer des fichiers .po ."
163 |
164 | #: ../../contributing.rst:94
165 | msgid ""
166 | "If you want to write translations on an existing language, or even add a new "
167 | "translation, you first have to build .po files using the following commands:"
168 | msgstr ""
169 | "Si vous voulez écrire des traductions sur une langue déjà présente, ou bien "
170 | "ajouter une langue, vous aurez tout d’abord besoin de construire les "
171 | "fichiers .po via les commandes suivantes :"
172 |
173 | #: ../../contributing.rst:102
174 | msgid "Don’t forget to replace “fr” with your own language!"
175 | msgstr "N’oubliez pas de remplacer « fr » par votre propre langue !"
176 |
177 | #: ../../contributing.rst:104
178 | msgid ""
179 | "You now have to complete the translation process directly in Poedit. The "
180 | "files to edit are in the *locale/fr/\\*.po* dir (remember, use your own "
181 | "language code)."
182 | msgstr ""
183 | "Il vous reste à compléter le processus de traduction directement "
184 | "dans Poedit. Les fichiers à traduire sont dans le dossier *locale/fr/\\*.po* "
185 | "(n’oubliez pas d’utiliser votre propre code de langue)."
186 |
187 | #: ../../contributing.rst:107
188 | msgid ""
189 | "Poedit can generate .mo files by its own. If you can’t, for any reason, "
190 | "compile your .po files into Poedit, there is a command for that:"
191 | msgstr ""
192 | "Poedit pout générer des fichiers .mo tout seul. Si vous ne pouvez pas, pour "
193 | "quelque raison que ce soit, compiler vos fichiers. mo, il existe une "
194 | "commande pour ça :"
195 |
196 | #: ../../contributing.rst:114
197 | msgid ""
198 | "You can compile the Sphinx documentation for your language with the "
199 | "following command:"
200 | msgstr ""
201 | "Vous pouvez compiler la documentation Sphinx pour votre langue via la "
202 | "commande suivante :"
203 |
204 | #: ../../contributing.rst:121
205 | msgid ""
206 | "**If** you added a new language, you will have to open an issue on Github, "
207 | "asking for creation of that lang. In the meantime, you are free to submit "
208 | "your translations with pull-requests."
209 | msgstr ""
210 | "**Si** vous avez ajouté une nouvelle langue, vous devrez ouvrir un ticket "
211 | "sur Github pour demander l’intégration de cette langue. Entre-temps, vous "
212 | "êtes libre de soumettre vos traductions par des pull-requests."
213 |
--------------------------------------------------------------------------------
/docs/conf.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python3
2 | # -*- coding: utf-8 -*-
3 | #
4 | # PHP-Bottle documentation build configuration file, created by
5 | # sphinx-quickstart on Sun Mar 8 22:00:27 2015.
6 | #
7 | # This file is execfile()d with the current directory set to its
8 | # containing dir.
9 | #
10 | # Note that not all possible configuration values are present in this
11 | # autogenerated file.
12 | #
13 | # All configuration values have a default; values that are commented out
14 | # serve to show the default.
15 |
16 | import sys
17 | import os
18 |
19 | # If extensions (or modules to document with autodoc) are in another directory,
20 | # add these directories to sys.path here. If the directory is relative to the
21 | # documentation root, use os.path.abspath to make it absolute, like shown here.
22 | #sys.path.insert(0, os.path.abspath('.'))
23 |
24 | # -- General configuration ------------------------------------------------
25 |
26 | # If your documentation needs a minimal Sphinx version, state it here.
27 | #needs_sphinx = '1.0'
28 |
29 | # Add any Sphinx extension module names here, as strings. They can be
30 | # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
31 | # ones.
32 | extensions = []
33 |
34 | # Add any paths that contain templates here, relative to this directory.
35 | templates_path = ['_templates']
36 |
37 | # The suffix of source filenames.
38 | source_suffix = '.rst'
39 |
40 | # The encoding of source files.
41 | #source_encoding = 'utf-8-sig'
42 |
43 | # The master toctree document.
44 | master_doc = 'index'
45 |
46 | # General information about the project.
47 | project = 'PHP-Bottle'
48 | copyright = '2015, Nergal, Gordon'
49 |
50 | # The version info for the project you're documenting, acts as replacement for
51 | # |version| and |release|, also used in various other places throughout the
52 | # built documents.
53 | #
54 | # The short X.Y version.
55 | version = '0.1.0'
56 | # The full version, including alpha/beta/rc tags.
57 | release = '0.1.0'
58 |
59 | # The language for content autogenerated by Sphinx. Refer to documentation
60 | # for a list of supported languages.
61 | #language = None
62 |
63 | # There are two options for replacing |today|: either, you set today to some
64 | # non-false value, then it is used:
65 | #today = ''
66 | # Else, today_fmt is used as the format for a strftime call.
67 | #today_fmt = '%B %d, %Y'
68 |
69 | # List of patterns, relative to source directory, that match files and
70 | # directories to ignore when looking for source files.
71 | exclude_patterns = ['_build']
72 |
73 | # The reST default role (used for this markup: `text`) to use for all
74 | # documents.
75 | #default_role = None
76 |
77 | # If true, '()' will be appended to :func: etc. cross-reference text.
78 | #add_function_parentheses = True
79 |
80 | # If true, the current module name will be prepended to all description
81 | # unit titles (such as .. function::).
82 | #add_module_names = True
83 |
84 | # If true, sectionauthor and moduleauthor directives will be shown in the
85 | # output. They are ignored by default.
86 | #show_authors = False
87 |
88 | # The name of the Pygments (syntax highlighting) style to use.
89 | pygments_style = 'sphinx'
90 |
91 | # A list of ignored prefixes for module index sorting.
92 | #modindex_common_prefix = []
93 |
94 | # If true, keep warnings as "system message" paragraphs in the built documents.
95 | #keep_warnings = False
96 |
97 |
98 | # -- Options for HTML output ----------------------------------------------
99 |
100 | # The theme to use for HTML and HTML Help pages. See the documentation for
101 | # a list of builtin themes.
102 | html_theme = 'default'
103 |
104 | # Theme options are theme-specific and customize the look and feel of a theme
105 | # further. For a list of options available for each theme, see the
106 | # documentation.
107 | #html_theme_options = {}
108 |
109 | # Add any paths that contain custom themes here, relative to this directory.
110 | #html_theme_path = []
111 |
112 | # The name for this set of Sphinx documents. If None, it defaults to
113 | # " v documentation".
114 | #html_title = None
115 |
116 | # A shorter title for the navigation bar. Default is the same as html_title.
117 | #html_short_title = None
118 |
119 | # The name of an image file (relative to this directory) to place at the top
120 | # of the sidebar.
121 | #html_logo = None
122 |
123 | # The name of an image file (within the static path) to use as favicon of the
124 | # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
125 | # pixels large.
126 | #html_favicon = None
127 |
128 | # Add any paths that contain custom static files (such as style sheets) here,
129 | # relative to this directory. They are copied after the builtin static files,
130 | # so a file named "default.css" will overwrite the builtin "default.css".
131 | html_static_path = ['_static']
132 |
133 | # Add any extra paths that contain custom files (such as robots.txt or
134 | # .htaccess) here, relative to this directory. These files are copied
135 | # directly to the root of the documentation.
136 | #html_extra_path = []
137 |
138 | # If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
139 | # using the given strftime format.
140 | #html_last_updated_fmt = '%b %d, %Y'
141 |
142 | # If true, SmartyPants will be used to convert quotes and dashes to
143 | # typographically correct entities.
144 | #html_use_smartypants = True
145 |
146 | # Custom sidebar templates, maps document names to template names.
147 | #html_sidebars = {}
148 |
149 | # Additional templates that should be rendered to pages, maps page names to
150 | # template names.
151 | #html_additional_pages = {}
152 |
153 | # If false, no module index is generated.
154 | #html_domain_indices = True
155 |
156 | # If false, no index is generated.
157 | #html_use_index = True
158 |
159 | # If true, the index is split into individual pages for each letter.
160 | #html_split_index = False
161 |
162 | # If true, links to the reST sources are added to the pages.
163 | #html_show_sourcelink = True
164 |
165 | # If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
166 | #html_show_sphinx = True
167 |
168 | # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
169 | #html_show_copyright = True
170 |
171 | # If true, an OpenSearch description file will be output, and all pages will
172 | # contain a tag referring to it. The value of this option must be the
173 | # base URL from which the finished HTML is served.
174 | #html_use_opensearch = ''
175 |
176 | # This is the file name suffix for HTML files (e.g. ".xhtml").
177 | #html_file_suffix = None
178 |
179 | # Output file base name for HTML help builder.
180 | htmlhelp_basename = 'PHP-Bottledoc'
181 |
182 |
183 | # -- Options for LaTeX output ---------------------------------------------
184 |
185 | latex_elements = {
186 | # The paper size ('letterpaper' or 'a4paper').
187 | #'papersize': 'letterpaper',
188 |
189 | # The font size ('10pt', '11pt' or '12pt').
190 | #'pointsize': '10pt',
191 |
192 | # Additional stuff for the LaTeX preamble.
193 | #'preamble': '',
194 | }
195 |
196 | # Grouping the document tree into LaTeX files. List of tuples
197 | # (source start file, target name, title,
198 | # author, documentclass [howto, manual, or own class]).
199 | latex_documents = [
200 | ('index', 'PHP-Bottle.tex', 'PHP-Bottle Documentation',
201 | 'Nergal, Gordon', 'manual'),
202 | ]
203 |
204 | # The name of an image file (relative to this directory) to place at the top of
205 | # the title page.
206 | #latex_logo = None
207 |
208 | # For "manual" documents, if this is true, then toplevel headings are parts,
209 | # not chapters.
210 | #latex_use_parts = False
211 |
212 | # If true, show page references after internal links.
213 | #latex_show_pagerefs = False
214 |
215 | # If true, show URL addresses after external links.
216 | #latex_show_urls = False
217 |
218 | # Documents to append as an appendix to all manuals.
219 | #latex_appendices = []
220 |
221 | # If false, no module index is generated.
222 | #latex_domain_indices = True
223 |
224 |
225 | # -- Options for manual page output ---------------------------------------
226 |
227 | # One entry per manual page. List of tuples
228 | # (source start file, name, description, authors, manual section).
229 | man_pages = [
230 | ('index', 'php-bottle', 'PHP-Bottle Documentation',
231 | ['Nergal, Gordon'], 1)
232 | ]
233 |
234 | # If true, show URL addresses after external links.
235 | #man_show_urls = False
236 |
237 |
238 | # -- Options for Texinfo output -------------------------------------------
239 |
240 | # Grouping the document tree into Texinfo files. List of tuples
241 | # (source start file, target name, title, author,
242 | # dir menu entry, description, category)
243 | texinfo_documents = [
244 | ('index', 'PHP-Bottle', 'PHP-Bottle Documentation',
245 | 'Nergal, Gordon', 'PHP-Bottle', 'One line description of project.',
246 | 'Miscellaneous'),
247 | ]
248 |
249 | # Documents to append as an appendix to all manuals.
250 | #texinfo_appendices = []
251 |
252 | # If false, no module index is generated.
253 | #texinfo_domain_indices = True
254 |
255 | # How to display URL addresses: 'footnote', 'no', or 'inline'.
256 | #texinfo_show_urls = 'footnote'
257 |
258 | # If true, do not generate a @detailmenu in the "Top" node's menu.
259 | #texinfo_no_detailmenu = False
260 |
261 | sys.path.append(os.path.abspath('_exts'))
262 |
263 | # ajouter PhpLexer
264 | from sphinx.highlighting import lexers
265 | from pygments.lexers.web import PhpLexer
266 |
267 | # ...
268 | # ajoute les extensions à la liste des extensions
269 | extensions = ['sensio.sphinx.refinclude',
270 | 'sensio.sphinx.configurationblock', 'sensio.sphinx.phpcode']
271 |
272 | # active la coloration syntaxique par défaut pour le code PHP qui n'est pas
273 | # entre ````
274 | lexers['php'] = PhpLexer(startinline=True)
275 | lexers['php-annotations'] = PhpLexer(startinline=True)
276 |
277 | # ajoute PHP comme domaine principal
278 | primary_domain = 'php'
279 |
280 | language = 'fr'
281 | locale_dirs = ['locale/']
282 | gettext_combat = True
283 |
--------------------------------------------------------------------------------
/docs/locale/fr/LC_MESSAGES/quickstart.po:
--------------------------------------------------------------------------------
1 | #
2 | msgid ""
3 | msgstr ""
4 | "Project-Id-Version: PHP-Bottle 0.1.0\n"
5 | "Report-Msgid-Bugs-To: \n"
6 | "POT-Creation-Date: 2015-03-09 21:57+0100\n"
7 | "PO-Revision-Date: 2015-12-14 11:01+0100\n"
8 | "Last-Translator: Damien Nicolas \n"
9 | "Language-Team: PHP-Bottle \n"
10 | "Language: fr\n"
11 | "MIME-Version: 1.0\n"
12 | "Content-Type: text/plain; charset=UTF-8\n"
13 | "Content-Transfer-Encoding: 8bit\n"
14 | "X-Generator: Poedit 1.8.5\n"
15 |
16 | #: ../../quickstart.rst:2
17 | msgid "Quickstart"
18 | msgstr "Guide de démarrage rapide"
19 |
20 | #: ../../quickstart.rst:4
21 | msgid ""
22 | "This short guide will show you how to start a PHP-Bottle project. It should "
23 | "take only a few minutes to make you understand the basics."
24 | msgstr ""
25 | "Ce court guide vous présentera la création d’un projet PHP-Bottle. Il ne "
26 | "devrait prendre que quelques minutes pour vous faire comprendre les bases."
27 |
28 | #: ../../quickstart.rst:8
29 | msgid "Installation"
30 | msgstr "Installation"
31 |
32 | #: ../../quickstart.rst:10
33 | msgid ""
34 | "You first need a working PHP5 environment. An HTTP server is not required "
35 | "for development."
36 | msgstr ""
37 | "Il vous faut tout d’abord un environnement PHP5 fonctionnel. Un serveur HTTP "
38 | "n’est pas requis pour le développement."
39 |
40 | #: ../../quickstart.rst:13
41 | msgid "Create a directory for your application (let’s call it *projectDir*)"
42 | msgstr "Créez un dossier pour votre application (appelons-le *dossierProjet*)"
43 |
44 | #: ../../quickstart.rst:14
45 | msgid ""
46 | "Fetch the last PHP-Bottle archive here: https://github.com/nergal/php-bottle/"
47 | "raw/master/build/bottle.phar and put it in the root of *projectDir*"
48 | msgstr ""
49 | "Récupérez l’archive PHP-Bottle ici : https://github.com/nergal/php-bottle/"
50 | "raw/master/build/bottle.phar et placez-le à la racine de votre "
51 | "*dossierProjet*"
52 |
53 | #: ../../quickstart.rst:17
54 | msgid ""
55 | "Fetch the *.htaccess* file that will enable URL rewriting here: https://"
56 | "github.com/nergal/php-bottle/raw/master/.htaccess and put it near the "
57 | "*bottle.phar* file."
58 | msgstr ""
59 | "Récupérez le fichier *.htaccess* qui permettra la réécriture d’URL ici : "
60 | "https://github.com/nergal/php-bottle/raw/master/.htaccess et placez-le près "
61 | "de votre fichier *bottle.phar*."
62 |
63 | #: ../../quickstart.rst:20
64 | msgid "Create a *views* directory in *projectDir*"
65 | msgstr "Créez un dossier *views* dans *dossierProjet*"
66 |
67 | #: ../../quickstart.rst:22
68 | msgid "You’re done! Everything is ready to write your first PHP-Bottle page!"
69 | msgstr ""
70 | "C’est fait ! Tout est prêt pour que vous puissiez écrire votre première page "
71 | "avec PHP-Bottle !"
72 |
73 | #: ../../quickstart.rst:25
74 | msgid "First page"
75 | msgstr "Première page"
76 |
77 | #: ../../quickstart.rst:27
78 | msgid ""
79 | "Okay, last step was too complicated, I got that. So let’s make things "
80 | "simpler: just copy that in a *index.php* file:"
81 | msgstr ""
82 | "Ok, la dernière étape était trop compliquée, j’ai saisi. Alors baissons d’un "
83 | "cran la difficulté : copiez simplement ça dans un fichier *index.php* :"
84 |
85 | #: ../../quickstart.rst:45
86 | msgid ""
87 | "Well, was that too hard? We’re ready to test that. Open a terminal, move to "
88 | "*projectDir*, and type:"
89 | msgstr ""
90 | "Bien, c’était si compliqué ? Nous sommes prêts à tester ça. Ouvrez un "
91 | "terminal, déplacez-vous dans *dossierProjet*, et tapez :"
92 |
93 | #: ../../quickstart.rst:48
94 | msgid "$ php -S localhost:8000"
95 | msgstr "$ php -S localhost:8000"
96 |
97 | #: ../../quickstart.rst:50
98 | msgid ""
99 | "**Don’t close the terminal yet!** We’ve just started a development HTTP "
100 | "server. Yup, it was embedded in PHP all that time (well, since `PHP "
101 | "5.4.0`__). Now, just open a web browser to the following URL: http://"
102 | "localhost:8000 . You should see a page welcoming you. Great, that’s a basic "
103 | "hello world, and we didn’t have to write a frawemork to do that!"
104 | msgstr ""
105 | "**Ne fermez pas encore votre terminal !** Nous avons tout juste démarré un "
106 | "serveur de développement PHP. Ouaip, c’était inclus dans PHP depuis tout ce "
107 | "temps (enfin, depuis `PHP 5.4.0`__). Maintenant, il vous suffit d’ouvrir un "
108 | "navigateur web et de charger l’URL http://localhost:8000 . Vous devriez voir "
109 | "une page vous accueillant en anglais. Génial, c’est un bête *hello world*, "
110 | "et il n’était pas nécessaire de développer un framework pour ça !"
111 |
112 | #: ../../quickstart.rst:58
113 | msgid "But let’s make something cooler. Like **dynamic URLs**!"
114 | msgstr ""
115 | "Mais nous allons faire quelque chose de plus cool. Comme des **URLs "
116 | "dynamiques** !"
117 |
118 | #: ../../quickstart.rst:61
119 | msgid "Dynamic URLs"
120 | msgstr "URLs Dynamiques"
121 |
122 | #: ../../quickstart.rst:63
123 | msgid ""
124 | "Did you notice the funny comment just before the *index* function? That’s a "
125 | "**decorator**, but some weird frameworks call that an **annotation**. We’ll "
126 | "keep the first one."
127 | msgstr ""
128 | "Avez-vous remarqué le drôle de commentaire juste au-dessus de la fonction "
129 | "*index* ? C’est un **décorateur**, mais certains frameworks bizarres "
130 | "appellent ça une **annotation**. On s’en tiendra à la première version."
131 |
132 | #: ../../quickstart.rst:67
133 | msgid ""
134 | "That decorator tells PHP-Bottle when to call that function: in this case, "
135 | "when an URL matching “/” is found. Try this: change that line, replacing “/” "
136 | "by “my/dynamic/url”. Refresh the page (no need to restart the development "
137 | "server we started before), and don’t fear: you just met a 404 error."
138 | msgstr ""
139 | "Ce décorateur indique à PHP-Bottle quand appeler cette fonction : en "
140 | "l’occurrence, quand une URL correspondant à « / » est trouvée. Essayez ça : "
141 | "modifiez cette ligne, et remplacez « / » par « /mon/url/dynamique ». "
142 | "Rechargez la page (il n’y a pas besoin de redémarrer le serveur de "
143 | "développement que nous avons lancé plus tôt), et ne paniquez pas : vous "
144 | "venez de rencontrer une erreur 404."
145 |
146 | #: ../../quickstart.rst:72
147 | msgid ""
148 | "Why? Because no function (we call these *controllers*) has been registered "
149 | "for the “/” URL. In other words, the requested page is not found."
150 | msgstr ""
151 | "Pourquoi ? Parce qu’aucune fonction (qu’on appellera **contrôleur**) n’a été "
152 | "enregistré pour traiter l’URL « / ». En d’autres termes, la page demandée "
153 | "est introuvable."
154 |
155 | #: ../../quickstart.rst:75
156 | msgid ""
157 | "But what if you try to get to http://localhost:8000/my/dynamic/url ? Right, "
158 | "your welcome message is here. We changed the *route* decorator, and it "
159 | "literally changed the URL of our page."
160 | msgstr ""
161 | "Mais que se passe-t-il si vous allez sur la page http://localhost:8000/mon/"
162 | "url/dynamique ? Bien, notre message d’accueil est de nouveau là. Nous avons "
163 | "modifié le décorateur *route*, et il a littéralement modifié l’URL de notre "
164 | "page."
165 |
166 | #: ../../quickstart.rst:79
167 | msgid ""
168 | "For the next step, we should go back to an index page routed on the */* URL. "
169 | "So go back to the “First page” example."
170 | msgstr ""
171 | "Pour l’étape suivante, il vaut mieux repartir sur l’ancienne version de la "
172 | "page d’index, où celle-ci était routée sur l’URL */*. Alors repartons sur "
173 | "l’exemple « Première page »."
174 |
175 | #: ../../quickstart.rst:83
176 | msgid "Multiple pages"
177 | msgstr "Plusieurs pages"
178 |
179 | #: ../../quickstart.rst:85
180 | msgid "Add this to the end of your *index.php* file:"
181 | msgstr "Ajoutez ceci à la fin de votre fichier *index.php* :"
182 |
183 | #: ../../quickstart.rst:96
184 | msgid ""
185 | "Look closely at the defined *route* for this controller: it contains a word "
186 | "prefixed by a colon. That means the “:name” is a variable, a dynamic part of "
187 | "a (already dynamic) URL. You can call whatever URL beginning by “/hello/”, "
188 | "and the rest will be in the $name variable. Try it, with http://"
189 | "localhost:8000/hello/world , then replace “world” by your own name."
190 | msgstr ""
191 | "Regardez attentivement la *route* définie pour ce contrôleur. Elle contient "
192 | "un mot préfixé d’un deux-points. Cela signifie que « :name » est une "
193 | "variable, une partie dynamique d’une URL (elle-même déjà dynamique). Vous "
194 | "pouvez appeler n’importe quelle URL commençant par « /hello/ », et le reste "
195 | "sera passé dans votre variable $name. Essayez ça, avec http://localhost:8000/"
196 | "hello/world, puis remplacez « world » par votre propre nom."
197 |
198 | #: ../../quickstart.rst:102
199 | msgid ""
200 | "You can see that the “:name” part of the URL is indeed given to the "
201 | "*hello()* function as the *$name* argument."
202 | msgstr ""
203 | "Vous voyez que la partie « :name » de l’URL est effectivement passée en "
204 | "paramètre à la fonction *hello()* en tant que *$name*."
205 |
206 | #: ../../quickstart.rst:105
207 | msgid ""
208 | "A route can define as many variables as you wish, if you add them as params "
209 | "for your controller."
210 | msgstr ""
211 | "Une route peut définir autant de variables que vous le souhaitez, si vous "
212 | "les ajoutez également comme paramètres à votre contrôleur."
213 |
214 | #: ../../quickstart.rst:109
215 | msgid "Views"
216 | msgstr "Vues"
217 |
218 | #: ../../quickstart.rst:111
219 | msgid ""
220 | "Remember the :ref:`main page `, telling that PHP-Bottle was a (M)VC "
221 | "framework? Well, we’ve seen the C(ontroller), let’s see the V(iew)."
222 | msgstr ""
223 | "Vous vous souvenez de la :ref:`page d’accueil`, indiquant que PHP-"
224 | "Bottle était un framework (M)VC ? Et bien, nous avons vu le C(ontrôleur), "
225 | "voyons la V(ue)."
226 |
227 | #: ../../quickstart.rst:114
228 | msgid ""
229 | "A view is the “how do I show it” part of an application, opposing to a "
230 | "controller, which is the “what do I show”."
231 | msgstr ""
232 | "Une vue représente la partie « comment est-ce que je l’affiche » d’une "
233 | "application, en opposition au contrôleur, qui est plutôt le « qu’est-ce que "
234 | "j’affiche »."
235 |
236 | #: ../../quickstart.rst:117
237 | msgid "So basically, a view is a code meant only to display something."
238 | msgstr ""
239 | "Donc, basiquement, une vue est une portion de code uniquement destinée à "
240 | "afficher quelque chose."
241 |
242 | #: ../../quickstart.rst:119
243 | msgid ""
244 | "PHP-Bottle has chosen to use a well-known template engine to do that: PHP."
245 | msgstr ""
246 | "PHP-Bottle a choisi d’utiliser un moteur de templates bien connu : PHP."
247 |
248 | #: ../../quickstart.rst:121
249 | msgid ""
250 | "In order to use views, you first have to declare one in your decorators. "
251 | "Here is an example:"
252 | msgstr ""
253 | "Pour pouvoir utiliser les vues, vous devez tout d’abord en déclarer dans vos "
254 | "décorateurs. Voici un exemple :"
255 |
256 | #: ../../quickstart.rst:134
257 | msgid ""
258 | "The @view decorator links to the position of the view file, relative to the "
259 | "index.php file. You can use whatever extension you like for the view."
260 | msgstr ""
261 | "Le décorateur @view pointe vers la position du fichier de vue, relativement "
262 | "au fichier index.php. Vous pouvez utiliser n’importe quelle extension pour "
263 | "la vue."
264 |
265 | #: ../../quickstart.rst:137
266 | msgid ""
267 | "The second step, after the @view decorator, is to return an associative "
268 | "array in your controller. Keys of this array will be extracted into vars "
269 | "available in your view. So, in */views/view-test.php*, you can display the "
270 | "way you want the *$var* variable, as defined in the controller. Write in */"
271 | "views/view-test.php*:"
272 | msgstr ""
273 | "La seconde étape, après avoir ajouté un décorateur @view, est de retourner "
274 | "un tableau associatif dans votre contrôleur. Les clés de ce tableau seront "
275 | "extraites dans des variables disponibles dans votre vue. Donc, dans */views/"
276 | "view-test.php*, vous pouvez afficher de la façon dont vous voulez la "
277 | "variable *$var*, telle que définie dans votre contrôleur. Écrivez ceci dans "
278 | "*/views/view-test.php* :"
279 |
280 | #: ../../quickstart.rst:146
281 | msgid ""
282 | "Now, open your browser to http://localhost:8000/view-test and observe. You "
283 | "see a
tag, saying “Hello world”. The last part of this sentence was "
284 | "given by the controller. It could as well be a dynamic value."
285 | msgstr ""
286 | "Maintenant, ouvrez votre navigateur sur http://localhost:8000/view-test et "
287 | "observez. Vous avez une balise
contenant “Hello world”. La dernière "
288 | "partie de cette phrase a été fournie par le contrôleur. Il aurait tout aussi "
289 | "bien pu s’agir d’une valeur dynamique."
290 |
--------------------------------------------------------------------------------