Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Gettext::query() can't pass domain param #12598

Closed
mervick opened this issue Feb 4, 2017 · 1 comment
Closed

[BUG] Gettext::query() can't pass domain param #12598

mervick opened this issue Feb 4, 2017 · 1 comment
Labels
wontfix The issue will not be fixed or implemented

Comments

@mervick
Copy link
Contributor

mervick commented Feb 4, 2017

Gettext::query() have ability (gettext.zep#L100) to change translations domain, by passing third argument, but php throws error

BadMethodCallException: Wrong number of parameters

seems due to lack of declaration in the method gettext.zep#L87

Provide minimal script to reproduce the issue

$gettext = new \Phalcon\Translate\Adapter\Gettext([
    'locale' => 'en_US',
    'defaultDomain' => 'translations',
    'directory' => '/path/to/files',
]);

$gettext->query('text', null, 'domain');

Details

  • Phalcon version: (php --ri phalcon)
Web framework delivered as a C-extension for PHP
phalcon => enabled
Author => Phalcon Team and contributors
Version => 2.0.12
Build Date => Nov  7 2016 02:43:30
Powered by Zephir => Version 0.9.4a-dev-eda63b3263

Directive => Local Value => Master Value
phalcon.db.escape_identifiers => On => On
phalcon.db.force_casting => Off => Off
phalcon.orm.events => On => On
phalcon.orm.virtual_foreign_keys => On => On
phalcon.orm.column_renaming => On => On
phalcon.orm.not_null_validations => On => On
phalcon.orm.exception_on_failed_save => Off => Off
phalcon.orm.enable_literals => On => On
phalcon.orm.late_state_binding => Off => Off
phalcon.orm.enable_implicit_joins => On => On
phalcon.orm.cast_on_hydrate => Off => Off
phalcon.orm.ignore_unknown_columns => Off => Off
  • PHP Version: (php -v)
PHP 5.6.29-1+deb.sury.org~xenial+1 (cli)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
    with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies
    with Xdebug v2.4.1, Copyright (c) 2002-2016, by Derick Rethans
  • Operating System: Ubuntu 16.04, Linux 4.4.0-57-generic x86_64
  • Installation type: Compiling from source
  • Zephir version: 0.9.4a-dev-eda63b3263
  • Server: Nginx
@sergeyklay
Copy link
Contributor

Declaration of Phalcon\Translate\Adapter\Gettext::query must be compatible with Phalcon\Translate\AdapterInterface::query. We can't extend the query method.

As noticed @mervick in the #12606 (comment) we can create

public function dquery(string! domain, string! index, placeholders = null) -> string

or

public function dquery(string! index, placeholders = null, string! domain = null) -> string

or users can override Phalcon\Translate\Adapter\Gettext class to add new method.

@sergeyklay sergeyklay removed this from the 3.0.4 milestone Feb 12, 2017
@sergeyklay sergeyklay added the wontfix The issue will not be fixed or implemented label Feb 12, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix The issue will not be fixed or implemented
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants