Repository navigation
API Lang
Caligrafy Quill 2.32.0. Generated from the source by
php qa/build-api-reference.php; the guides explain how to use these classes, this reference says exactly what each public method takes and returns. Back to the API reference.
Part of Other classes.
namespace Caligrafy;
class LangSource: framework/core/Lang.php:28
Lang.php The languages of an application (2.28.0): its words in one file per language, the visitor's language, right to left
RTL = array('ar', 'arc', 'ckb', 'dv', 'fa', 'he', 'ku', 'ps', 'sd', 'ug', 'ur', 'yi')COOKIE = 'lang'
-
public static $path = null: string|null where the files are; null: application/lang (tests point it elsewhere) -
public static $cookie = null: callable|null test hook: fn($name, $value, $options) instead of setcookie
Lang::locales()Lang::fallback()Lang::locale()Lang::set()Lang::remember()Lang::dir()Lang::get()Lang::has()Lang::group()Lang::all()Lang::url()Lang::money()Lang::number()Lang::date()Lang::reset()Lang::words()Lang::file()Lang::validatorLanguage()Lang::fromAcceptLanguage()
public static function locales()The languages of the app: APP_LOCALES, lowercased, in its order (en when empty)
Source: framework/core/Lang.php:46
public static function fallback()The language used when none is asked for: APP_LOCALE when it is one of the app's, else the first of APP_LOCALES
Source: framework/core/Lang.php:61
public static function locale()The language of this request (found once: the address, the cookie, the browser, then the fallback)
Source: framework/core/Lang.php:75
public static function set($code)Uses a language for the rest of the request (a job writing to a person in theirs); false when it is not one of the app's
Parameters
$code
Source: framework/core/Lang.php:87
public static function remember($code)Uses a language and remembers it in the visitor's cookie for a year (a language menu)
Parameters
$code
Source: framework/core/Lang.php:100
public static function dir($code = null)rtl or ltr: the direction a language is written in (this request's when none is given)
Parameters
-
$code, defaultnull
Source: framework/core/Lang.php:118
public static function get($key, array $vars = array(), $code = null)A word of the app in this request's language (or $code's): its file, then the fallback's, then the key itself. $vars replace {name}; a count picks a form of "one|other" or "zero|one|other"
Parameters
$key-
$varsarray, defaultarray() -
$code, defaultnull
Source: framework/core/Lang.php:128
public static function has($key, $code = null)Whether the language (this request's when none is given) has that word in its own file
Parameters
$key-
$code, defaultnull
Source: framework/core/Lang.php:161
public static function group($prefix, $code = null)The words under a key, without it: group('validation') gives ['required' => ...]. The fallback's fill the gaps
Parameters
$prefix-
$code, defaultnull
Source: framework/core/Lang.php:169
public static function all($code = null)Every word of a language (the fallback's under it), flattened: for a page's script (lang_json())
Parameters
-
$code, defaultnull
Source: framework/core/Lang.php:187
public static function url($code, $uri = null)The address of this page in another language (?lang=<code>, the rest of the query kept)
Parameters
$code-
$uri, defaultnull
Source: framework/core/Lang.php:196
public static function money($amount, $currency, $code = null)An amount of money in a language's way: "$1,234.50", "1 234,50 €", "١٬٢٣٤٫٥٠ US$" (intl), else "1,234.50 USD"
Parameters
$amount$currency-
$code, defaultnull
Source: framework/core/Lang.php:209
public static function number($value, $decimals = 0, $code = null)A number in a language's way ("1,234.5", "1 234,5")
Parameters
$value-
$decimals, default0 -
$code, defaultnull
Source: framework/core/Lang.php:227
public static function date($value, $style = 'medium', $code = null, $timezone = null)A date (a timestamp or a date string) in a language's way: short, medium, long or full (intl), else "25 Nov 2026"
Parameters
$value-
$style, default'medium' -
$code, defaultnull -
$timezone, defaultnull
Source: framework/core/Lang.php:244
public static function reset()Forgets the request's language and the words read (tests, a long-running worker between requests)
Source: framework/core/Lang.php:265
public static function words($code)The words of a language, flattened (home.title), read once from application/lang/<code>.json. A file that is not valid JSON gives none (doctor says why)
Parameters
$code
Source: framework/core/Lang.php:275
public static function file($code)The file of a language: application/lang/<code>.json (or $path)
Parameters
$code
Source: framework/core/Lang.php:296
public static function validatorLanguage()The language GUMP speaks for the validator: this request's when GUMP has it (vendor/wixel/gump/lang), else en
Source: framework/core/Lang.php:308
public static function fromAcceptLanguage($header, array $locales)The app's language the browser prefers (fr-CA;q=0.9 matches fr), or null
Parameters
$header-
$localesarray
Source: framework/core/Lang.php:346
Caligrafy: Describe it. Approve it. Ship it. Your idea turned into a complete app: every feature built once, for web pages, Vue apps, a REST API and AI agents, and online.
Why Caligrafy: the benefits, the measurements, and what it is not yet
-
Quickstart with Claude: describe it, approve it, ship it
or the Quickstart: the same three steps by hand, in 5 minutes
- How Caligrafy works: the ideas in 5 minutes
- Your first capability: build a feature, page included
-
Capabilities in depth
-
#[Capability]: every option - Scheduled jobs: capabilities on a timer
- Notifications: web push and email
- Background jobs: capabilities run later
- Migrations: database changes, in order
- The cache
-
Testing your app
- Dependency injection
- Validation rules
-
Web pages
- Views and page components
- Design styles: another look, one setting
- Declarative routes: every request, in one line
-
Route::page·Route::form·Route::auth·Route::webhook·Route::download·Route::redirect·Route::action·Route::snap· capability routes - How to export a list as CSV
- Controllers: moving one to a declared route · how to, step by step
- Forms and helpers
-
Vue apps
-
Mobile and tablet
-
REST API
-
AI agents
-
Snap Cards and the assistant
- Payments: Stripe and crypto
- Face detection and face login
- OpenAI: chat and images · Assistants
- Open models: Llama, Mistral...
- Chatbots with Watson
- Machine learning in the browser
- Phone and tablet apps: iOS and Android
- Languages: translations, right to left
- Metadata and social cards · search and analytics
-
Putting it online: the production image, the database at every start
-
API reference: every class and method
-
Routing ·
Route·AuthRoutes· pages ·Controller· capabilities -
Data ·
Model·Query· sign-in · jobs ·Notify· payments · AI -
Interfaces · Snap ·
Snap\Cards·Snap\Conversation· testing · tooling · helper functions
-
Routing ·
-
Caligrafer: every command
- Project · build · data · agents · jobs and tests · maintenance · deploy
- Installation, configuration and Caligrafer
- Routing · Request · Controllers · Views
- Vue: flow of information · routes · validations
- Security and upgrading
- Release notes: 2.32 · 2.31 · 2.30 · 2.29 · 2.28 · 2.27 · 2.26 · 2.25 · 2.24 · 2.23 · 2.22 · 2.21 · 2.20 · 2.19 · 2.18 · 2.17 · 2.16 · 2.15 · 2.14 · 2.13 · 2.12 · 2.11 · 2.10 · 2.9 · 2.8 · 2.7 · 2.6 · 2.5 · 2.4 · 2.3 · 2.1 · October 2026 · changelog
- Testing Caligrafy (contributors)