{"record":{"id":"7c10b40b3b2dd9be","repo":"phalcon/cphalcon","slug":"translation-content-was-not-provided","errorCode":null,"errorMessage":"Translation content was not provided","messagePattern":"Translation content was not provided","errorType":"exception","errorClass":"Phalcon\\Translate\\Exceptions\\MissingContent","httpStatus":null,"severity":"error","filePath":"phalcon/Translate/Adapter/NativeArray.zep","lineNumber":50,"sourceCode":"\n    /**\n     * NativeArray constructor.\n     *\n     * @phpstan-param translate_array_options $options\n     *\n     * @throws InvalidDataType\n     * @throws MissingContent\n     */\n    public function __construct(\n        <InterpolatorFactory> interpolator,\n        array options\n    ) {\n        var data;\n\n        parent::__construct(interpolator, options);\n\n        if unlikely !fetch data, options[\"content\"] {\n            throw new MissingContent();\n        }\n\n        if unlikely typeof data !== \"array\" {\n            throw new InvalidDataType();\n        }\n\n        let this->translate = data;\n    }\n\n    /**\n     * Check whether is defined a translation key in the internal array\n     *\n     * @deprecated\n     */\n    public function exists(string index) -> bool\n    {\n        return this->has(index);\n    }","sourceCodeStart":32,"sourceCodeEnd":68,"githubUrl":"https://github.com/phalcon/cphalcon/blob/b7419de9cd0a8a3f48441ead84c9f8415d463e25/phalcon/Translate/Adapter/NativeArray.zep#L32-L68","documentation":"The NativeArray adapter stores translations in a plain PHP array passed via the 'content' option; the constructor fetches options['content'] and throws Phalcon\\Translate\\Exceptions\\MissingContent when the key is absent (phalcon/Translate/Adapter/NativeArray.zep:50). Here 'content' is the data array itself, unlike the Csv adapter where it is a file path.","triggerScenarios":"new NativeArray($factory, ['triggerError' => true]) — any options array without a 'content' key.","commonSituations":"Translations included from a file that failed to load (include returning false/1 instead of an array); option named 'data' or 'translations'; options assembled in a branch that sometimes skips content; config caching that drops the entry.","solutions":["Pass the dictionary: ['content' => ['key' => 'translation', ...]].","When loading from a PHP file, ensure it ends with return [...]; and use ['content' => require $path].","Assert array_key_exists('content', $options) in the factory that builds the adapter."],"exampleFix":"// before\n$t = new NativeArray($factory, ['triggerError' => true]);\n\n// after\n$t = new NativeArray($factory, [\n    'content' => require app_path('messages/en.php'),\n]);","handlingStrategy":"validation","validationCode":"if (!array_key_exists('content', $options)) {\n    throw new InvalidArgumentException('NativeArray adapter requires the content option (translation array)');\n}\n$t = new NativeArray($factory, $options);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always build content via require of a file that ends with `return [...];`.","Add a factory assertion that the loaded dictionary is a non-empty array.","Remember: for NativeArray 'content' is the data itself, not a path."],"tags":["phalcon","translate","native-array","missing-option","i18n"],"backgroundTag":"missing-required-option","analyzedSha":"b7419de9cd0a8a3f48441ead84c9f8415d463e25","analyzedAt":"2026-08-21T06:21:18.811Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}