Skip to content

Can't pass custom language array #11

@vidurb

Description

@vidurb

Hi, I'm having an issue passing in a custom 'Language'. I was following the documentation where it says:

// the renderer class options
$rendererOptions = [
// how detailed the rendered HTML in-line diff is? (none, line, word, char)
'detailLevel' => 'line',
// renderer language: eng, cht, chs, jpn, ...
// or an array which has the same keys with a language file
'language' => 'eng',

I tried passing in an array for the language key, but it threw an error:

Uncaught PHP Exception TypeError: "Argument 2 passed to Jfcherng\Diff\Renderer\AbstractRenderer::updateLanguage() must be of the type string, array given, called in /var/www/api.getastra.com/vendor/jfcherng/php-diff/src/Renderer/AbstractRenderer.php on line 85"

From what I can tell, although the Language constructor accepts and detects a string (for one of the bundled language) or an array (for a custom language), the updateLanguage() method of AbstractRenderer is set to only accept a string as its second parameter. Have I misunderstood how to pass in a custom language, or is this a bug?

Many thanks,
Vidur

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions