Comments (7)
I'm not sure how this is possible. It simply grabs the languages as they exist in the languages object:
https://github.com/getgrav/grav-plugin-langswitcher/blob/develop/langswitcher.php#L61
and then just loops over them:
Can you add a {{ dump(langobj) }}
in line 3 of langswitcher.html.twig? You will need to turn on the debugger and the result should show up in the first 'messages' tab.
from grav-plugin-langswitcher.
@rhukster thanks for quick reply - appreciate it!
Here is log (pastebin):
It looks like it's there but for some reason he doesn't display it on front-end.
Its not just Chinese, my en-us
which is default locale doesn't show up as well. I tried to wrap it in quotes "" and see whether it solves the problem but no difference. This is how it looks like currently in navigation on front-end - missing en-us
and zh-tw
- only Korean (ko
) and Simplified Chinese (zh
) are visible:
from grav-plugin-langswitcher.
what does your supported_languages
array look like in system.yaml ?
from grav-plugin-langswitcher.
@rhukster first 17 lines of my user/config/system.yaml:
absolute_urls: false
param_sep: ':'
wrapped_site: false
reverse_proxy_setup: false
languages:
supported:
- en-us
- ko
- zh
- zh-tw
include_default_lang: false
translations: true
translations_fallback: true
session_store_active: true
http_accept_language: true
override_locale: true
from grav-plugin-langswitcher.
Yah i don't think Grav likes it when you mix types (ie xx and xx-xx). What happens if you remove ko
and zh
temporarily ?
from grav-plugin-langswitcher.
If I remove ko
& zh
, none of the languages will show up in navigation. When I inspect element, its just empty <ul class="langswitcher"> </ul>
.
I changed the format and made them standing in one array like this - supported: [en-us, ko, zh, zh-tw]
but no difference. Still those two are missing. This for sure has something to do with formatting. From Ruby I remember it should solve this problem if you wrap them in quotes (e.g. supported: ["en-us", ko, zh, "zh-tw"]
but this doesn't help in this case as well :(
from grav-plugin-langswitcher.
Actually.... i think i know the problem, it's a limitation of Grav\Common\Languages\LanguageCodes::getNames()
This method only knows how to lookup xx
style language codes. This would have to be improved to support xx-xx styles too.
https://github.com/getgrav/grav/blob/develop/system/src/Grav/Common/Language/LanguageCodes.php
Would you mind opening up an issue here: https://github.com/getgrav/grav/issues for this specifically?
from grav-plugin-langswitcher.
Related Issues (20)
- Plugin doesn't work with include_default_lang: false HOT 1
- Adding x-default fallback? HOT 3
- Plugin generates wrong hreflang code HOT 1
- Session storage "traps" user in a language HOT 5
- switching works fine on localhost but fails when on the server HOT 1
- How to change the Display of the the Languages HOT 1
- Tailing slashes vary HOT 4
- Let the root url be the default language without any language path HOT 3
- Where to add language selector code? HOT 4
- wrong hreflang genereated when run in subdirectory HOT 2
- Big bug - last part of url are not translated to alternate language - the same value of rawRoute() is used for all languages HOT 13
- When `http_accept_language` is set to true, manual switching does not work HOT 3
- Two URLs for additional laguage using slug HOT 14
- Non-existent page: Call to a member function slug() on null HOT 3
- Default language doesn't appear under certain configurations HOT 5
- Full path not being created for other-language pages HOT 22
- If 'default route' is set for a given page, this page’s children become inaccessible via the Langswitcher button -- secondary langauges only HOT 6
- 3.0 update slows down site HOT 1
- link href="alternative" being created for pages that don't exist HOT 1
- Select menu as a configurable display option
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from grav-plugin-langswitcher.