We had a problem where the translations would no longer be loaded when downloaded through the glotpress_download grunt task. We noticed that we didn't have this problem when downloading the MO files manually from GlotPress, so we figured it might be an encoding issue.
After some debugging together with @tacoverdo, I think we've finally found the solution.
We also found that no encoding options were passed into the request function that downloads the MO file, resulting in a utf8 string encoding (as is the default).
In order to make sure the response is correctly buffered and not converted into a string, we needed to set the encoding to null. After doing so, our translations were loaded correctly again. :smile_cat:
Fixes https://github.com/Yoast/google-analytics-for-wordpress/issues/305
We had a problem where the translations would no longer be loaded when downloaded through the
glotpress_download
grunt task. We noticed that we didn't have this problem when downloading the MO files manually from GlotPress, so we figured it might be an encoding issue.After some debugging together with @tacoverdo, I think we've finally found the solution.
We found that the MO file was written away here in an "unsigned long (always 32 bit, little endian byte order)" binary format.
We also found that no encoding options were passed into the
request
function that downloads the MO file, resulting in autf8
string encoding (as is the default).When looking at the Node documentation, I could see there is also a
binary
encoding available, which has been deprecated in favour of Buffer objects.In order to make sure the response is correctly buffered and not converted into a string, we needed to set the encoding to
null
. After doing so, our translations were loaded correctly again. :smile_cat: