Permalink
Browse files

[en] Correct grammar and formulation (#721)

  • Loading branch information...
Kubo2 authored and dg committed Sep 16, 2018
1 parent 733fd44 commit 9911dff56b9fd74875a4478777b01f460b3c63c9
Showing with 20 additions and 20 deletions.
  1. +20 −20 en/bootstrap.texy
@@ -9,18 +9,18 @@ Nette application is easily configured using NEON files. We'll talk about:
- how to create the DI container
\--

Setting environment and creating a Dependency Injection (DI) container is in Nette in charge of the [Configurator |api:Nette\Configurator] class. It is used in the bootstrap file `bootstrap.php` located in the `app/` folder.
In charge of setting up the environment and creating a Dependency Injection (DI) container in Nette is the [Configurator |api:Nette\Configurator] class. It is used in the bootstrap file `bootstrap.php` located in the `app/` folder.

Development Mode
================

Development mode is automatically active when we develop on *localhost*. If you want to enable it even outside of it, for example, programmers accessing a specific IP address, we will use `setDebugMode()`:
Development mode is automatically enabled when we're running on *localhost*. If you want to enable it even outside of there, for example, programmers accessing from a specific IP address, you can use `setDebugMode()`:

/--php
$configurator->setDebugMode('23.75.345.200'); // one or more IP addresses
\--

Even more secured is the combination of IP address and cookie. We will store a secret token into the `nette-debug' cookie, e.q `secret1234`, the development mode is activated for programmers with this IP and set up cookie.
Even more secure is the combination of an IP address and a cookie. We will store a secret token into the `nette-debug' cookie, e.g. `secret1234`, and the development mode will be activated for programmers with this combination of IP and cookie.

/--php
$configurator->setDebugMode('secret1234@23.75.345.200');
@@ -36,7 +36,7 @@ $configurator->setDebugMode(false);
Debugging Tool Tracy
====================

Turn on great debugging tool [Tracy |tracy:], it'll store all exceptions files into specified folder (`__DIR__ . '/../log'`).
Turn on the great debugging tool [Tracy |tracy:], it'll store all exceptions into files in a specified folder (`__DIR__ . '/../log'`).

/--php
$configurator->enableTracy(__DIR__ . '/../log');
@@ -46,7 +46,7 @@ $configurator->enableTracy(__DIR__ . '/../log');
Caching
=======

The configuration is loaded and processed only once, and the result is cached, which greatly accelerates the application. Therefore, we set the `setTempDirectory()` path where the cache will be saved.
The configuration is loaded and processed only once, and the result is cached, which greatly speeds up the application. Therefore, we set the `setTempDirectory()` path where the cache will be saved.

/--php
$configurator->setTempDirectory(__DIR__ . '/../temp');
@@ -56,21 +56,21 @@ $configurator->setTempDirectory(__DIR__ . '/../temp');
RobotLoader
===========

Usually we will want to automatically load the classes using [RobotLoader |robotloader], so we have to start it and let it load the classes from the directory where `bootstrap.php` is located and all subdirectories (ie `__DIR__`):
Usually we will want to automatically load the classes using [RobotLoader |robotloader], so we have to start it up and let it load classes from the directory where `bootstrap.php` is located and all its subdirectories (i.e. `__DIR__`):

/--php
$configurator->createRobotLoader()
->addDirectory(__DIR__)
->register();
\--

Alternative way is to use only [Composer |composer] PSR-4 autoloading.
An alternative way is to only use [Composer |composer] PSR-4 autoloading.


Timezone
========

There is a way how to setup timezone.
Configurator allows you to specify a timezone for your application.

/--php
$configurator->setTimeZone('Europe/Prague');
@@ -80,15 +80,15 @@ $configurator->setTimeZone('Europe/Prague');
Configuration Files
===================

According to configuration files, a system DI container is generated, which is the heart of the entire application. Typically, they are written in [NEON |https: //ne-on.org] format. In a separate chapter, you can read [everything about configuration |configuring].
Typically, configuration files are written in the [NEON |https: //ne-on.org] format. Based on the configuration files, a system DI container is generated. This is the heart of the entire application. In a separate chapter, you can read [everything about configuration |configuring].

We load the configuration files using `addConfig()`:

/--php
$configurator->addConfig(__DIR__ . '/config/config.neon');
\--

Method `addConfig()` can be called multiple times to add multiple files.
The method `addConfig()` can be called multiple times to add multiple files.

/--php
$configurator->addConfig(__DIR__ . '/config/common.neon');
@@ -98,7 +98,7 @@ if (PHP_SAPI === 'cli') {
}
\--

Alternatively we can use `includes` section to load more configuration files.
Alternatively we can use the `includes` section to load more configuration files.

/--neon
includes:
@@ -107,13 +107,13 @@ includes:
- presenters.neon
\--

If items with the same keys appear in configuration files, they will be [overwritten or merged |di-configuration#Multiple configuration files] in the case of arrays. The later included file has higher priority. The file with the `includes` section has higher priority than included files.
If items with the same keys appear within configuration files, they will be [overwritten, or merged |di-configuration#Multiple configuration files] in the case of arrays. Each subsequent file has a higher priority in merging. The file containing the `includes` section has a higher priority than the included files.


Parameters
==========

Parameters could be passed to the DI container over `addParameters()` method, their values must be known at the compile time. The container is always generated for the different values of these parameters.
Parameters can be passed to the DI container by the `addParameters()` method; their values must be known at compile time. The container is always generated for the different values of these parameters.

/--php
$configurator->addParameters([
@@ -122,21 +122,21 @@ $configurator->addParameters([
]);
\--

We can access `foo` parameter via `%foo%` in configuration files. The configurator adds be default these parameters `appDir`, `wwwDir`, `tempDir`, `debugMode` a `consoleMode`.
In configuration files, we can write `%foo%` to access the parameter named `foo`. By default, the Configurator populates the following parameters: `appDir`, `wwwDir`, `tempDir`, `debugMode` and `consoleMode`.


Dynamic Parameters
==================

We can set also dynamic parameters to DI container, their values must not be known at compile time, they are used at run time. It doesn't generate a new container.
We can also feed dynamic parameters to the DI container. Their values needn't be known at compile time: they are used at run time. Different values don't regenerate the container.

/--php
$configurator->addDynamicParameters([
'remoteIp' => $_SERVER['REMOTE_ADDR'],
]);
\--

The environment variables could be easily set up using dynamic parameters. We can access them via `%env.variable%` in configuration files.
Environment variables could be easily made available using dynamic parameters. We can access them via `%env.variable%` in configuration files.

/--php
$configurator->addDynamicParameters([
@@ -148,7 +148,7 @@ $configurator->addDynamicParameters([
Dynamic Services
================

We can insert an instance of the class into the DI container directly, before the DI container creates it for us. The service must be defined with `dynamic: yes` attribute.
We can insert an instance of a class into the DI container directly, before the DI container creates it for us. The service must be defined with the `dynamic: yes` attribute.

/--neon
services:
@@ -169,20 +169,20 @@ $configurator->addServices([
Creating a Container
====================

The container class generates and its instance returns `createContainer()`:
The method `createContainer()` generates the container class and returns its instance:

/--php
/** @var Nette\DI\Container $container */
$container = $configurator->createContainer();
\--

In the developer mode, the container is automatically updated each time you change the code or configuration files. In production mode it is generated only once and file changes are not checked for performance.
In the development mode, the container is automatically updated each time you change the code or configuration files. In production mode, it is generated only once and file changes are not checked to avoid compromising performance.


index.php
=========

If we are creating a web application, all requests goes through one file located in public directory `www/` and that is `index.php`. It only passes the control to the application (that is the `app/` directory), to a boot file `bootstrap.php`. Subsequently, `index.php` retrieves from the DI container the service that runs the web application:
If we are creating a web application, all requests are handled by one file located in the public `www/` directory, and that is `index.php`. It just passes the control to the application (that is the `app/` directory), to the bootstrap file `bootstrap.php`. Subsequently, `index.php` retrieves from the DI container the service that runs the web application:

/--php
$container = require __DIR__ . '/../app/bootstrap.php';

0 comments on commit 9911dff

Please sign in to comment.