Closed Taroxx closed 2 years ago
i will do a research, but the exception which is thrown seems clear to me: The requested language 'xx' does not exist in language table in /site/vendor/luyadev/luya-module-cms/src/Menu.php:709
- so you where trying to open an url yourwebsite.com/xx
?
i will do a research, but the exception which is thrown seems clear to me:
The requested language 'xx' does not exist in language table in /site/vendor/luyadev/luya-module-cms/src/Menu.php:709
- so you where trying to open an urlyourwebsite.com/xx
?
Yes, Im trying to open yourwebsite.com/xx and yourwebsite.com/xx/servisec and etc... And in prod i have this (yii2 default) error page or this stack trace (without css styles) in local mode
Withal app log has the same error stack trace.
Yii version 2.0.43 php 7.3.31 nginx 1.20.1 mariaDB part of composer "require": { "luyadev/luya-core" : "^1.0", "luyadev/luya-module-admin" : "^3.0", "luyadev/luya-module-cms" : "^3.0", "luyadev/luya-bootstrap3" : "^1.0", "luyadev/luya-generic" : "^1.0", "yiisoft/yii2-smarty": "^2.0", "luyadev/luya-module-news": "~2.0", "yiisoft/yii2-httpclient": "^2.0", "cebe/luya-module-sitemap": "^1.2", "thadafinser/user-agent-parser": "^2.0", "rmrevin/yii2-minify-view": "^2.0", "alexandernst/yii2-device-detect": "0.0.12" },
Yes, Im trying to open yourwebsite.com/xx and yourwebsite.com/xx/servisec
But what is xx
in this case? Is this a page which slug xx
? Or is it a language you have not created yet?
Pages with a slug of only 2 chars does not work, because it try to resolve those as language.
"luyadev/luya-core" : "^1.0", "luyadev/luya-module-admin" : "^3.0", "luyadev/luya-module-cms" : "^3.0",
I am very sure it won't fix the problem, but please upgrade to latest versions. Core is not required, but instead add ^4.0 for cms and admin, see: https://github.com/luyadev/luya-kickstarter-bootstrap4/blob/master/composer.json#L6-L8
But what is
xx
in this case? Is this a page which slugxx
? Or is it a language you have not created yet?
This is a language, it can be any two characters, except "en".
I am very sure it won't fix the problem, but please upgrade to latest versions. Core is not required, but instead add ^4.0 for cms and admin, see: https://github.com/luyadev/luya-kickstarter-bootstrap4/blob/master/composer.json#L6-L8
ok
Ok, but have you added the language xx
to your languages tables in the admin UI?
No. According to this logic, should I to add all combinations of letters (like aa, ab, ac, ad ... nm, nz, jy and etc) to the table? Аt least it's weird
You have to, this language is bound to the cms. We only provide a translation solution for language which are exists in the table and afterwards you can edit those languages also in the CMS.
I think you are talking about a "frontend" translation solution according to https://www.yiiframework.com/doc/guide/2.0/en/tutorial-i18n
But this has "nothing" to do with the CMS. The CMS and its language are bound to the LUYA language table at its all about providing the content for different languages from within the CMS!
Only I want - is 404 page on yourwebsite.com/xx yourwebsite.com/xx/serb/saf yourwebsite.com/zz yourwebsite.com/aa/serb/saf
and etc
I dont need to translate my site. My site is single language.
My site is EN only!
Moreover, I want to see 404 page on yourwebsite.com/en page. This case I did with on beforeAction
in configuration by throw NotFoundHttpException()
on any page, that containt /en/
.
Composition is hide by hidden => true
!
no need for !!!
here. Yes its about the error page indeed, i forgot that. thought you have those languages but can't resolve them in your website.
Maybe:
'composition' => [
'expectedValues' => ['en']
]
could do the trick, but i need to verify this first.
And what about aa,ab,ac,ad ... zx,zy,zz
?
I am very sure it won't fix the problem, but please upgrade to latest versions. Core is not required, but instead add ^4.0 for cms and admin, see: https://github.com/luyadev/luya-kickstarter-bootstrap4/blob/master/composer.json#L6-L8
Problem 1
- luyadev/luya-module-admin 4.1.0 requires luyadev/luya-core ^2.0 -> satisfiable by luyadev/luya-core[2.0.0, 2.0.1] but these conflict with your requirements or minimum-stability.
- luyadev/luya-module-admin 4.0.0 requires luyadev/luya-core ^2.0 -> satisfiable by luyadev/luya-core[2.0.0, 2.0.1] but these conflict with your requirements or minimum-stability.
- Installation request for luyadev/luya-module-admin ^4.0 -> satisfiable by luyadev/luya-module-admin[4.0.0, 4.1.0].
What does your composer.json look like?
{
"name": "luyadev/luya-kickstarter",
"description": "The kickstarter project for a new LUYA application.",
"type": "luya-kickstarter",
"license":"MIT",
"require": {
"luyadev/luya-core" : "^1.0",
"luyadev/luya-module-admin" : "^4.0",
"luyadev/luya-module-cms" : "^4.0",
"luyadev/luya-bootstrap3" : "^1.0",
"luyadev/luya-generic" : "^1.0",
"yiisoft/yii2-smarty": "^2.0",
"luyadev/luya-module-news": "~2.0",
"yiisoft/yii2-httpclient": "^2.0",
"cebe/luya-module-sitemap": "^1.2",
"thadafinser/user-agent-parser": "^2.0",
"rmrevin/yii2-minify-view": "^2.0",
"alexandernst/yii2-device-detect": "0.0.12"
},
"require-dev": {
"yiisoft/yii2-gii" : "^2.0",
"yiisoft/yii2-debug" : "^2.0",
"luyadev/luya-testsuite" : "^1.0"
},
"scripts": {
"post-create-project-cmd": [
"yii\\composer\\Installer::postCreateProject"
]
},
"extra": {
"yii\\composer\\Installer::postCreateProject": {
"setPermission": [
{
"public_html/assets": "0777",
"public_html/storage": "0777",
"runtime" : "0777"
}
]
},
"asset-installer-paths": {
"bower-asset-library": "vendor/bower"
},
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"config": {
"fxp-asset": {
"enabled": false
}
},
"repositories": [
{
"type": "composer",
"url": "https://asset-packagist.org"
}
]
}
I mentioned that already:
Core is not required, but instead add ^4.0 for cms and admin, see: https://github.com/luyadev/luya-kickstarter-bootstrap4/blob/master/composer.json#L6-L8
Maybe also use testsuite version ^3.0
or remove it if you don't need that
Stay at 3.0. Update to 4.0 upgrade core to 2.0 automaticaly and dont work to me. Too many errors after this update.
As you wish. The upgrade guides are very ease, not much to upgrade, mainly run migrate and import and ensure no to use Yii::$app->composition->language and check the part with the view files in the your "app blocks" (cms upgrade)
Maybe later, thanks.
I am very sure it won't fix the problem, but please upgrade to latest versions. Core is not required, but instead add ^4.0 for cms and admin, see: https://github.com/luyadev/luya-kickstarter-bootstrap4/blob/master/composer.json#L6-L8
Now I need to solve the problem with an error instead of 404.
ensure no to use Yii::$app->composition->language
What do you mean?
Maybe later, thanks.
I have updated to last version, but error sill there.
Found in logs
[warning][yii\i18n\PhpMessageSource::loadMessages] The message file for category 'yii' does not exist: /site/vendor/yiisoft/yii2/messages/xx/yii.php
in /site/vendor/luyadev/luya-module-cms/src/Menu.php:705
in /site/vendor/luyadev/luya-module-cms/src/Menu.php:325
in /site/vendor/luyadev/luya-module-cms/src/Menu.php:216
With real short code (random lang) this warning has not been
I am currently preparing a vhost for your example, so i try to summary all informations you gave to check wheather i understand correctly or not:
example.com
is in english and you have hidden the composition which will generate links like example.com/about-me
and so on. :heavy_check_mark: example.com/does-not-exists
shows the custom 404 page (this also works, as far as i understood, if the slug is long enought, more then 2 chars) :heavy_check_mark: example.com/xx
an Exception The requested language 'xx' does not exist in language table
is thrown BUT INSTEAD IT SHOULD RETURN THE 404 PAGE? :white_check_mark: example.com/xx
should show the 404 custom :white_check_mark: expectedValues' => ['en']
should ensure that only the en language is allowed and any other langue short code will throwns an exception, but this did not work in your case? :question: 1-4 yes, thats right
5.
expectedValues' => ['en']
should ensure that only the en language is allowed and any other langue short code will throwns an exception, but this did not work in your case? ❓
Table admin_lang
have one row - is en
and it is default.
When I open url like example.com/en
or example.com/en/page1
i have seen pages like example.com
or example.com/page1
without any errors. This is not good too, but this case I did with hook on beforeAction
in configuration by throw NotFoundHttpException()
on any page, that containt /en/.
You can see, that this is not the best solution. If you mean that expectedValues' => ['en']
at composition section solve this problem, I will try this.
Next. I temporary added random langs to admin_table
, to debug this problem, after that urls with this shortcodes (like example.com/de or example.com/de/page1
) open 404 page, but not custom, for example
Next. I temporary diactiveted custom 404. But there is no result.
Next. When I try to open url with random shortcode, which is not in the table, I have this php error. Stack trace above.
I tried to intercept this exception at on beforeAction
but there is no Result. But previous exception
in stack trace is been like below
Previous exception:
yii\web\NotFoundHttpException in /site/configs/config.php:172
Stack trace:
#0 [internal function]: luya\base\Boot->{closure}(Object(yii\base\ActionEvent))
#1 /site/vendor/yiisoft/yii2/base/Component.php(628): call_user_func(Object(Closure), Object(yii\base\ActionEvent))
#2 /site/vendor/yiisoft/yii2/base/Module.php(706): yii\base\Component->trigger('beforeAction', Object(yii\base\ActionEvent))
#3 /site/vendor/yiisoft/yii2/base/Controller.php(169): yii\base\Module->beforeAction(Object(yii\base\InlineAction))
#4 /site/vendor/yiisoft/yii2/base/Module.php(534): yii\base\Controller->runAction('', Array)
#5 /site/vendor/yiisoft/yii2/web/Application.php(104): yii\base\Module->runAction('', Array)
#6 /site/vendor/luyadev/luya-core/web/Application.php(52): yii\web\Application->handleRequest(Object(luya\web\Request))
#7 /site/vendor/yiisoft/yii2/base/Application.php(392): luya\web\Application->handleRequest(Object(luya\web\Request))
#8 /site/vendor/luyadev/luya-core/base/Boot.php(255): yii\base\Application->run()
#9 /site/vendor/luyadev/luya-core/base/Boot.php(195): luya\base\Boot->applicationWeb()
#10 /site/public_html/index.php(13): luya\base\Boot->run()
#11 {main}
I tried this
And get error on example.com/en or example.com/en/page1
pages
UPDATE This error on all pages
https://github.com/luyadev/luya/blob/master/core/web/Composition.php#L120-L138
you have to configured it like this, i was not aware of that, sorry:
'expectedValues' => ['langShortCode' => ['en']]
I have the same problem https://github.com/luyadev/luya-module-cms/issues/183 Site is not multilang. Table admin_lang have one row. en is default. composition is disabled. custom 404 page created as module (like in tutorial); I tried online/offline 404 custom page, but result is the same. But in prod I have
An internal server error occurred.
Moreover, with empty layout (white page) I have the same error. By adding lang to table I dont have this error, but custom 404 page does not work and I have 404 page like in your screenshot above. (see https://github.com/luyadev/luya-module-cms/issues/183) This is stack traceOriginally posted by @Taroxx in https://github.com/luyadev/luya-module-cms/issues/183#issuecomment-976752796