Download the PHP package nobox/lazy-strings without Composer
On this page you can find all versions of the php package nobox/lazy-strings. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download nobox/lazy-strings
More information about nobox/lazy-strings
Files in nobox/lazy-strings
Package lazy-strings
Short Description Create localized strings from a Google Docs Spreadsheet.
License MIT
Homepage https://github.com/Nobox/Lazy-Strings
Informations about the package lazy-strings
Lazy Strings
Create localized strings from a Google Docs Spreadsheet.
Installation
Add Lazy Strings to your composer.json file.
Usage
Create an instance of LazyStrings with the following settings.
And generate your strings with the generate();
method.
Settings
Each setting key item is described below.
url
Add the Google spreadsheet published url. This should be done with File -> Publish to the web...
, replace pubhtml
with export?format=csv
at the end and use http
on the url. Remember that this document must be available to anyone. Use Public on the web
on your Sharing settings
. If not, Lazy Strings won't be able to parse it.
sheets
Here you'll specify all the sheets in your Google doc (if it's more than one) with their id, each separated by locale. Use an array if using more than one sheet for a locale. Example:
You can take the id from the spreadsheet using the gid
variable from your Google doc url. For example, in this spreadsheet: https://docs.google.com/a/nobox.com/spreadsheets/d/1V_cHt5Fe4x9XwVepvlXB39sqKXD3xs_QbM-NppkrE4A/edit#gid=1626663029 the id is 1626663029
.
target
Here you must specify a path where to store your translations.
Using these settings it will generate the following translation files in path/to/strings/folder
.
backup
Here you must specify a path where to store your translations in JSON format. More like a "backup" of your strings.
Using these settings it will generate the following translation files in path/to/strings/folder
.
nested
Specify whether or not you want your translations array to be nested.
If you use the nested setting as true
your translations will look like something like this:
And like this with false
.
How it works
Lazy Strings uses an id => value
convention to access the copy, it generates a lazy.php
file inside the specified language locale folder. You can see an example doc here.
id | value |
---|---|
title | Your page title |
tagline | Your page tagline |
laravel | PHP Framework |
header.hero.headline | Hero headlines |
header.hero.subject | Main hero subject |
Using this example doc (with nested translations) you can access the first row like this:
License
MIT