mirror of
https://github.com/codeguy/php-the-right-way.git
synced 2025-08-08 15:06:30 +02:00
@@ -1,22 +1,22 @@
|
||||
---
|
||||
isChild: true
|
||||
anchor: windows_setup
|
||||
---
|
||||
|
||||
## Windows Setup {#windows_setup_title}
|
||||
|
||||
You can download the binaries from [windows.php.net/download][php-downloads]. After the extraction of PHP, it is recommended to set the [PATH][windows-path] to the root of your PHP folder (where php.exe is located) so you can execute PHP from anywhere.
|
||||
|
||||
---
|
||||
isChild: true
|
||||
anchor: windows_setup
|
||||
---
|
||||
|
||||
## Windows Setup {#windows_setup_title}
|
||||
|
||||
You can download the binaries from [windows.php.net/download][php-downloads]. After the extraction of PHP, it is recommended to set the [PATH][windows-path] to the root of your PHP folder (where php.exe is located) so you can execute PHP from anywhere.
|
||||
|
||||
For learning and local development, you can use the built in webserver with PHP 5.4+ so you don't need to worry about
|
||||
configuring it. If you would like an "all-in-one" which includes a full-blown webserver and MySQL too then tools such
|
||||
as the [Web Platform Installer][wpi], [XAMPP][xampp], [EasyPHP][easyphp], [OpenServer][openserver] and [WAMP][wamp] will
|
||||
help get a Windows development environment up and running fast. That said, these tools will be a little different from
|
||||
production so be careful of environment differences if you are working on Windows and deploying to Linux.
|
||||
configuring it. If you would like an "all-in-one" which includes a full-blown webserver and MySQL too then tools such
|
||||
as the [Web Platform Installer][wpi], [XAMPP][xampp], [EasyPHP][easyphp], [OpenServer][openserver] and [WAMP][wamp] will
|
||||
help get a Windows development environment up and running fast. That said, these tools will be a little different from
|
||||
production so be careful of environment differences if you are working on Windows and deploying to Linux.
|
||||
|
||||
If you need to run your production system on Windows, then IIS7 will give you the most stable and best performance. You
|
||||
can use [phpmanager][phpmanager] (a GUI plugin for IIS7) to make configuring and managing PHP simple. IIS7 comes with
|
||||
FastCGI built in and ready to go, you just need to configure PHP as a handler. For support and additional resources
|
||||
there is a [dedicated area on iis.net][php-iis] for PHP.
|
||||
can use [phpmanager][phpmanager] (a GUI plugin for IIS7) to make configuring and managing PHP simple. IIS7 comes with
|
||||
FastCGI built in and ready to go, you just need to configure PHP as a handler. For support and additional resources
|
||||
there is a [dedicated area on iis.net][php-iis] for PHP.
|
||||
|
||||
Generally running your application on different environment in development and production can lead to strange bugs popping up when you go
|
||||
live. If you are developing on Windows and deploying to Linux (or anything non-Windows) then you should consider using a [Virtual Machine](/#virtualization_title).
|
||||
@@ -31,5 +31,5 @@ Chris Tankersley has a very helpful blog post on what tools he uses to do [PHP d
|
||||
[php-iis]: http://php.iis.net/
|
||||
[windows-path]: http://www.windows-commandline.com/set-path-command-line/
|
||||
[windows-tools]: http://ctankersley.com/2016/11/13/developing-on-windows-2016/
|
||||
[wpi]: http://www.microsoft.com/web/downloads/platform.aspx
|
||||
[wpi]: https://www.microsoft.com/web/downloads/platform.aspx
|
||||
[xampp]: http://www.apachefriends.org/en/xampp.html
|
||||
|
@@ -141,7 +141,7 @@ given number falls (starting the count with 0). For example:
|
||||
- Brazilian Portuguese: `nplurals=2; plural=(n > 1);` - two rules, second if N is bigger than one, first otherwise
|
||||
|
||||
Now that you understood the basis of how plural rules works - and if you didn't, please look at a deeper explanation
|
||||
on the [LingoHub tutorial](lingohub_plurals) -, you might want to copy the ones you need from a [list][plural] instead
|
||||
on the [LingoHub tutorial][lingohub_plurals] -, you might want to copy the ones you need from a [list][plural] instead
|
||||
of writing them by hand.
|
||||
|
||||
When calling out Gettext to do localization on sentences with counters, you'll have to give him the
|
||||
@@ -174,7 +174,7 @@ msgstr[1] "%d mensagens não lidas"
|
||||
The first section works like a header, having the `msgid` and `msgstr` especially empty. It describes the file encoding,
|
||||
plural forms and other things that are less relevant.
|
||||
The second section translates a simple string from English to
|
||||
Brazilian Portuguese, and the third does the same, but leveraging string replacement from [`sprintf`](sprintf) so the
|
||||
Brazilian Portuguese, and the third does the same, but leveraging string replacement from [`sprintf`][sprintf] so the
|
||||
translation may contain the user name and visit date.
|
||||
The last section is a sample of pluralization forms, displaying
|
||||
the singular and plural version as `msgid` in English and their corresponding translations as `msgstr` 0 and 1
|
||||
@@ -310,7 +310,7 @@ textdomain('main');
|
||||
To make matters easier - and one of the powerful advantages Gettext has over custom framework i18n packages - is its
|
||||
custom file type. "Oh man, that's quite hard to understand and edit by hand, a simple array would be easier!" Make no
|
||||
mistake, applications like [Poedit] are here to help - _a lot_. You can get the program from
|
||||
[their website](poedit_download), it's free and available for all platforms. It's a pretty easy tool to get used to,
|
||||
[their website][poedit_download], it's free and available for all platforms. It's a pretty easy tool to get used to,
|
||||
and a very powerful one at the same time - using all powerful features Gettext has available.
|
||||
|
||||
In the first run, you should select "File > New Catalog" from the menu. There you'll have a small screen where we will
|
||||
@@ -369,7 +369,7 @@ or maybe a fancy `_r()` that would join `gettext()` and `sprintf()` calls. Other
|
||||
In those cases, you'll need to instruct the Gettext utility on how to extract the strings from those new functions.
|
||||
Don't be afraid, it's very easy. It's just a field in the `.po` file, or a Settings screen on Poedit. In the editor,
|
||||
that option is inside "Catalog > Properties > Source keywords". You need to include there the specifications of those
|
||||
new functions, following [a specific format](func_format):
|
||||
new functions, following [a specific format][func_format]:
|
||||
|
||||
- if you create something like `t()` that simply returns the translation for a string, you can specify it as `t`.
|
||||
Gettext will know the only function argument is the string to be translated;
|
||||
@@ -385,7 +385,7 @@ After including those new rules in the `.po` file, a new scan will bring in your
|
||||
|
||||
* [Wikipedia: i18n and l10n](https://en.wikipedia.org/wiki/Internationalization_and_localization)
|
||||
* [Wikipedia: Gettext](https://en.wikipedia.org/wiki/Gettext)
|
||||
* [LingoHub: PHP internationalization with gettext tutorial](lingohub)
|
||||
* [LingoHub: PHP internationalization with gettext tutorial][lingohub]
|
||||
* [PHP Manual: Gettext](http://php.net/manual/en/book.gettext.php)
|
||||
* [Gettext Manual][manual]
|
||||
|
||||
|
Reference in New Issue
Block a user