wearerequired / traduttore

🗼 A WordPress plugin to improve the I18N workflow for your own projects based on @GlotPress.
https://wearerequired.github.io/traduttore/
72 stars 15 forks source link

mergeWith option doesn't work due to failing file_exists() check #225

Closed ocean90 closed 2 years ago

ocean90 commented 2 years ago

Issue Overview Traduttore has a handy mergeWith option which allows to merge an existing POT file with the default generated by Traduttore. Unfortunately this option doesn't work

To Reproduce Steps to reproduce the behavior:

  1. Create a project with a custom POT file and the mergeWith option
  2. Let Traduttore import the project
  3. After import notice that the strings from the custom POT file are not there

Expected behavior Strings from the custom POT file are also imported.

Additional context https://github.com/wearerequired/traduttore/blob/413cff440a85a49784ea677debc1b8301907e541/inc/Updater.php#L186-L188

The file_exists() is used for a relative path while the current directory may not be the directory of the plugin, usually the root directory of WordPress itself. The fix would be to prefix the merge value with $source.