Coder Social home page Coder Social logo

Comments (7)

rhukster avatar rhukster commented on July 21, 2024

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:

https://github.com/getgrav/grav-plugin-langswitcher/blob/develop/templates/partials/langswitcher.html.twig#L4-L16

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.

 avatar commented on July 21, 2024

@rhukster thanks for quick reply - appreciate it!
Here is log (pastebin):

http://pastebin.com/kqGKE8Bn

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:

screen shot 2016-05-29 at 1 54 26 am

from grav-plugin-langswitcher.

rhukster avatar rhukster commented on July 21, 2024

what does your supported_languages array look like in system.yaml ?

from grav-plugin-langswitcher.

 avatar commented on July 21, 2024

@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.

rhukster avatar rhukster commented on July 21, 2024

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.

 avatar commented on July 21, 2024

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.

rhukster avatar rhukster commented on July 21, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.