Cannot reproduce Language Importer fails

S Thomas

Well-known member
Affected version
2.0.4
When I import any language, the importer will create the language pack, but no modifications will be applied. Plus, if you choose that language, your whole site breaks.
  • ErrorException: Template error: Template admin:index is unknown
  • src/XF/Template/Templater.php:582
etc.

Steps to reproduce:
  1. Create a new language, set that to default
  2. Export English (US), delete it, import it back
  3. The importer will now improperly finish (not loading any more, no errors on Console)
  4. Choose English (US) as your language
Tested with all add-ons disabled on a freshly upgraded XF from 1.5.11 to 2.0.4 on default style with 0 modifications. Re-importing that language and overriding the old one seems to help, though.
 
Are you still able to consistently reproduce this?

I've just followed your exact steps and everything is working fine. The import finishes, the language is selectable and the site remains working fine.
 
@Chris D: Yes and no. I have clean installed 1.5.11 and upgraded to 2.0.4, everything works, no problems.
Taking the live data (1.5.11) however, it fails. I will once again try to upgrade the live data and report back.
 
@Chris D: This time I've deinstalled all addons and styles instead of just disabling them (this took me a good ******** while :D). After that, I've upgraded from .11 to .18 and then to 2.0.4. Still same problems.

The strange thing is SELECT title FROM `xf_phrase` GROUP BY title HAVING COUNT(title) != 2; gives null. Both the newly created language and the master language are equal (id 0 and 6). However, all phrases for the upgraded language (id 4) are missing.

Now, on the counter part, SELECT title FROM `xf_phrase_compiled` GROUP BY title HAVING COUNT(title) != 2; is still null - but this time all phrases from id 6 are missing.
Obviously, every template call fails for id 6. Example:
Server error log

ErrorException: Template error: Template admin:language_list is unknown src/XF/Template/Templater.php:582

Generated by: Admin Apr 12, 2018 at 2:49 AM

Stack trace

#0 [internal function]: XF\Template\Templater->handleTemplateError(512, 'Template admin:...', 'A...', 582, Array)
#1 src/XF/Template/Templater.php(582): trigger_error('Template admin:...', 512)
#2 src/XF/Template/Templater.php(537): XF\Template\Templater->getTemplateData('admin', 'language_list')
#3 src/XF/Template/Templater.php(1247): XF\Template\Templater->getTemplateCode('admin', 'language_list')
#4 src/XF/Template/Template.php(24): XF\Template\Templater->renderTemplate('language_list', Array)
#5 src/XF/Mvc/Renderer/Html.php(48): XF\Template\Template->render()
#6 src/XF/Mvc/Dispatcher.php(332): XF\Mvc\Renderer\Html->renderView('XF:Language\\Lis...', 'admin:language_...', Array)
#7 src/XF/Mvc/Dispatcher.php(303): XF\Mvc\Dispatcher->renderView(Object(XF\Mvc\Renderer\Html), Object(XF\Mvc\Reply\View))
#8 src/XF/Mvc/Dispatcher.php(44): XF\Mvc\Dispatcher->render(Object(XF\Mvc\Reply\View), 'html')
#9 src/XF/App.php(1891): XF\Mvc\Dispatcher->run()
#10 src/XF.php(328): XF\App->run()
#11 admin.php(13): XF::runApp('XF\\Admin\\App')
#12 {main}

Request state

array(4) {
["url"] => string(21) "/admin.php?languages/"
["referrer"] => string(52) "http://localhost/admin.php?languages/import"
["_GET"] => array(1) {
["languages/"] => string(0) ""
}
["_POST"] => array(0) {
}
}
So somehow on language import phrases & templates don't get recompiled. And on XF upgrade phrases are missing for the upgraded language.

Overwritting a language does indeed recompile all phrases & templates, the language works after that with no problems at all.
Same with php cmd.php xf-dev:recompile.
Any newly created languages work aswell after these steps.

My blind guess would be that the language ids are being messed up on upgrade from 1.5 to 2. The upgraded language has the id 4 (same as in 1.5) whereas the upgrader expects id 1? I don't know.
I tried setting the language ID from a clean 1.5.11 to 4 (creating and deleting languages until I got that id). After that I upgraded again to 2.0.4 and voilà, it fails.
So all in all, this is the definite way of reproducing:

  1. On 1.5.xx, create some languages until your language id hits e.g. 4 and delete all other languages.
  2. Upgrade to 2.0.4
  3. Export Import a language and choose that language
If you still can't reproduce it, let me know what I could do to debug this furthermore.

Edit: Nope, can't reproduce it with clean data. Looks like there is some mess within my 1.5 data even after having deinstalled all addons. How could I debug that?
 
Last edited:
If you're able to give us access to your 1.5 database we'll try and reproduce it and figure out what's going on. Probably best to submit a ticket if you want to go down that route.
 
Back
Top Bottom