Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

macOS lessons learned #13

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ Provide your application in multiple languages, to users in various countries, w

**Note:** On Windows, you may have to use the non-thread-safe (NTS) version of PHP.

**macOS:** To generate the po and mo files with the packaged bash script, install gnu-sed.
```zsh
$ brew install gnu-sed
$ PATH="$(brew --prefix)/opt/gnu-sed/libexec/gnubin:$PATH"
```

## Installation

1. Include the library via Composer [[?]](https://github.com/delight-im/Knowledge/blob/master/Composer%20(PHP).md):
Expand All @@ -20,7 +26,12 @@ Provide your application in multiple languages, to users in various countries, w
$ composer require delight-im/i18n
```

1. Include the Composer autoloader:
2. Copy the i18n bash script to the root of your project
```bash
$ cp vendor/delight-im/i18n/i18n.sh .
```

3. Include the Composer autoloader:

```php
require __DIR__ . '/vendor/autoload.php';
Expand Down Expand Up @@ -114,7 +125,7 @@ $i18n = new \Delight\I18n\I18n([

### Directory and file names for translation files

Your translation files will later have to be stored in the following location:
Your translation files will later have to be stored in the following location relative to the root of your project:

```
locale/<LOCALE_CODE>/LC_MESSAGES/messages.po
Expand Down
2 changes: 1 addition & 1 deletion i18n.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ sed -i '0,/\"Content-Type: text\/plain; charset=CHARSET\\n\"/{s/\"Content-Type:
if [ ! -z "${LOCALE_CODE}" ]; then
LOCALE_CONTENTS_DIR="${LOCALE_PARENT_DIR}/${LOCALE_CODE}/LC_MESSAGES"

mkdir --parents "${LOCALE_CONTENTS_DIR}"
mkdir -p "${LOCALE_CONTENTS_DIR}"

echo " * Creating PO (Portable Object) file for “${LOCALE_CODE}”"

Expand Down