Language files for Upload errors do not work #904

axelitus opened this Issue Apr 3, 2012 · 0 comments


None yet

2 participants

axelitus commented Apr 3, 2012

Using a language file in $APPATH/lang/xx/upload.php (where xx is the target language) does not work for error messages. This is because in the language file the upload error codes (numeric) are used to determine which error to display. The way that array_marge (or \Arr::merge() for that matter) is that they do not replace numeric keys, instead they are appended to the end of the array getting a new numeric index, thus the resulting upload's language array will have both languages: the default one (using the correct indexes) and the added languages (with new indexes that do not match the \Upload::{constants}).

It would seem as there's no additional language file at all because the default messages are always used, but the language file is loaded, just not to the correct indexes.

A quick fix would be to prepend all \Upload::{err_const} with a character (a.e. an underscore) to change the indexes to string keys. The call for the errors needs also this change to reflect the new key like \Lang::get('upload._'.$error['error']);

Here's an example of what needs to be changed in order to make the languages work for the Upload class:

I'll let you guys decide what is the best approach to fix this issue.

Credits go to theshadow who identified this issue first.

@WanWizard WanWizard was assigned Apr 4, 2012
@WanWizard WanWizard closed this in 13d6d5e Apr 4, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment