molajo / query
Molajo Query Services for PHP Applications
Installs: 505
Dependents: 2
Suggesters: 0
Security: 0
Stars: 0
Watchers: 5
Forks: 0
Open Issues: 0
Type:molajo-package
Requires
- php: >=5.4
- commonapi/cache: dev-master
- commonapi/exception: dev-master
- commonapi/query: dev-master
- molajo/fieldhandler: dev-master
- molajo/resource: dev-master
This package is auto-updated.
Last update: 2024-11-08 05:01:58 UTC
README
======= Query Package
Query Services supporting translations for the User Interface for PHP applications using Adapters for different implementation types (ex., Database, *.ini files, etc.).
System Requirements
- PHP 5.3.3, or above
- PSR-0 compliant Autoloader
- PHP Framework independent
- [optional] PHPUnit 3.5+ to execute the test suite (phpunit --version)
How to specify Query
Query strings are loaded in startup for language determined in this order (and installed):
- Injected value during class instantiation
- Session
- User Data
- Client Query
- Application Configuration
- Defaults to en-GB
Instantiation
To instantiate the Query Class:
$language = new Query($language);
Once instantiated, all calls to the class can be made using the $language instance.
Query Properties
To retrieve the key value (ex. 'en-GB') for the language which is loaded:
$language->get('language');
Retrieve Query Strings
To retrieve all language strings and translations for the loaded language:
$language->get('strings');
Retrieve List of all installed Querys
To retrieve a list of all languages installed in this application:
$language->get('installed');
Retrieve Query Attribute
To retrieve a registry attribute value (id, name, rtl, local, first_day) for the loaded language:
$language->get('name-of-attribute');
Retrieve all Query Attributes
To retrieve all registry attribute values as an array for the loaded language:
$language->get('registry');
Translate
To translate the string $xyz:
$language->translate($xyz);
To retrieve a list of language strings and translations matching a wildcard value:
$language->translate($xyz, 1);
Identify Untranslated Strings
To insert strings found in code but are not already in database:
- If an administrator is logged on, the primary language services automatically insert untranslated strings
- To avoid doing so, override the
QueryPlugin
and setinsert_missing_strings
to0
- For instances you define, set the
insert_missing_strings
, as needed.
To log strings found in code, but are not already in database:
- Set the Application configuration option
profile_missing_strings
to1
and turn onprofiling