Jump to content
Raul

Warnings parsing Language Packs

Recommended Posts

Hi all, 

Today I would want to translate my admin area into other language and I have downloaded  the last language pack.

But I don't have the last version of PW and thereby I don't have all files of the pack.

What is the result: a lot of warnings because the parser try to parse non-existent files.

A simple solution could be made in the file "LanguageParser.php" to the function:

/**
 * Begin parsing
 *
 */
protected function execute($file) {
 
        if (!file_exists( $file )) return;  <== this line avoid parsing non-existent files.
 
 
Regards,
Thanks 
Raul

Share this post


Link to post
Share on other sites

I'm just wondering if suppressing the warnings here is a good idea because this is an error condition that should probably be reported? The !is_file($file) return; is already in the parseFile() function that execute() calls, but that one isn't geared towards error suppression. I'm not sure I totally understand the conditions you ran into or why the errors should be suppressed here, but maybe a screenshot (or even pasting in the warnings) would clarify?

Share this post


Link to post
Share on other sites

Hi Ryan, 

The message was:
 

Warning: file_get_contents(/var/www/radeberger/wire/core/Password.php) [function.file-get-contents]: failed to open stream: File or directory doesn't exists in /var/www/radeberger/wire/modules/LanguageSupport/LanguageParser.php on line 125

I'm sorry.

I have wrote this before the update to PW2.3. Now it's fixed.

However I think always that the best is to stop the execution as soon as possible. Thereby:

1.- If a file doesn't exists, it is not necessary to call the parse function. It is not necessary to return an empty array too...Why?

2.- Calling a function suposes always resources to allocate.

3.- Moreover, a loop is executed altough an empty array is returned.. Why?

Yes, the loop has few elements but it's a loop....it has always a cost.

I don't want suppress errors. Error messages are good, but they can be logged instead of printed.

You can print a message to advice about them if they have not solution or are important to the execution.

In this case (parsing files) are the errors or warnings unnecessary, because they don't interrupt the execution and don't cause malfunction.

They can be avoided easily and logged silently.

For these reasons, It would be better to put the line before calling the funcion "parseFile".

Thank you very much for your reply.

Raul

Share this post


Link to post
Share on other sites

What is the result: a lot of warnings because the parser try to parse non-existent files.

Raul, is there any steps that we could take to reproduce these? I have played a lot with translations and I have never seen anything like that.

PW does have good error logging already, never outputs error messages on wild (unless you are superuser or in debug mode), so I don't fully understand what you are describing with error logging vs. printing.

Share this post


Link to post
Share on other sites

Hi Apeisa, 

The only way I know is to have a PW2.2.9 and the last german language pack. Latera I have updated PW and all works correctly.

About the errors, you are right. I'm always in debug mode and thereby I have seen this errors.

Also, I'm sorry if i have confused someone.

Thank you for your responses.

Raul

Share this post


Link to post
Share on other sites

And they're not errors but warnings. :-)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By AndZyk
      Hello,
      this maybe a simple question, but it bothers me for a while now:
      There used to be a warning, if two or more user try to edit the same page. But ever since AdminThemeUIkit I haven't seen it any more.
      Is this a bug or are there special circumstances under which the warning will be displayed?
      If I am logged-in in the same browser with one default and one privat window, I don't see this warning. But also different browsers on different machines in the same network don't see this warning.
      I was looking for the blog post on which this feature was announced, but couldn't find it anymore.
      We had the case, that two people were writing a text for the same page, but after person A saved the page first, the text of the person B was lost. I know we could have used ProDrafts for this case, but it shouldn't happen in the first place.
      I would appreciate some feedback. 😀
      Regards, Andreas
×
×
  • Create New...