After upgrade from version 1.2.2 to 1.2.3
Multilang at where using Rich Text Box have problem and unable to add or edit
Steps to reproduce the behavior:
use Translatable;
protected $translatable = ['body']; to model
ErrorException (E_NOTICE)
Undefined index: en
$transFields = $this->getTranslatableAttributes();
foreach ($transFields as $field) {
if (!$request->input($field.'_i18n')) {
throw new Exception('Invalid Translatable field'.$field);
}
$trans = json_decode($request->input($field.'_i18n'), true);
// Set the default local value
$request->merge([$field => $trans[config('voyager.multilingual.default', 'en')]]);
$translations[$field] = $this->setAttributeTranslations(
$field,
$trans
);
// Remove field hidden input
unset($request[$field.'_i18n']);
}
// Remove language selector input
unset($request['i18n_selector']);
return $translations;
Same here. New installation of 1.2.3 version still same error.
Same here, post data of _i18n-field is empty.
Same problem solved after delleting folders
public/vendor/tcg/voyager/
and update
config/voyager.php
as indicated in the documentation
https://docs.laravelvoyager.com/getting-started/upgrading
@cotiga
I just tried a fresh installation, translations of simple Text and Textboxes work, Rich-Text-translations don't.
Just tested and faced the same issue.
On initial page load the hidden field for "_i18n" is providing the correct value format: {"zn":"","cn":""}
However, when you are selecting different language the value for the hidden "_i18n" changed to: {"cn":""} instead.
Anyone knows which file trigger this action? I wish to take a look.
I managed to resolve the issue by changing 1 line at resources/assets/js/multilingual.js file. Upon changing you will need to run the command "npm run dev" to generate a new app.js file at voyager vendor folder itself.
I have created a pull request for this at #4077 so please do verify if it does fix your issues as well.
@ohmygod8 works for me, made my day!
@jannescb I noticed that there is one more issue to fix.
If you purposely let the form to return error, and then you switch the language the old values of the default value will be replaced with the second language.
I am looking at it now.
Works for me too!!! Thanks!
any fix ? this problem with me from 4days ago
I've changed this file, run npm run dev but same bug. Any suggestions?
I made a little node script that fixes this by using _inp.siblings instead of _inp.next.
The script checks the version of voyager in composer.lock and exits if the version is different from 'v1.2.3' therefore it could theoretically be integrated in CI.
It also offers options for using yarn and restoring the original file.
There is a short description in the comment of the gist
https://gist.github.com/mentAl-maZe/dbd7b3aa8b28679e22b37573fedc7f5f#gistcomment-2922836
This issue has been automatically locked since there has not been any recent activity after it was closed. If you have further questions please ask in our Slack group.
Most helpful comment
I managed to resolve the issue by changing 1 line at resources/assets/js/multilingual.js file. Upon changing you will need to run the command "npm run dev" to generate a new app.js file at voyager vendor folder itself.
I have created a pull request for this at #4077 so please do verify if it does fix your issues as well.