Giter VIP home page Giter VIP logo

Comments (6)

 avatar commented on August 30, 2024

+1
This would be a great addition to Vorto. Planning to move with Vorto for a big project, and being able to opt-out from applying all cultures on an item level would be extremely helpful.

from umbraco-vorto.

mattbrailsford avatar mattbrailsford commented on August 30, 2024

It is already possible to filter which languages appear in the list, however you must do it using Umbraco methods. The vorto prevalue lets you choose whether to display all languages or languages in use, If you choose languages in use, you can then also provide an XPath statement to locate the nodes with the languages defined on them, However, these languages need to be defined via the built in hostsname feature, rather than your own custom property.

This is the exact reason why the XPath field was incorporated so that you could create multiple sites within one install using different languages but only display the languages relevant to each site.

@seankearney to be honest, I can't quite get my head around your example, so not sure if you are requiring something else, but what I've explained above is how I've implemented filtered languages in vorto so myabe it will answer your question anyway.

from umbraco-vorto.

seankearney avatar seankearney commented on August 30, 2024

Matt, I do understand how the XPath based filtering of languages works, but it doesn't help my scenario. Let me try to clarify the requirement.

We have a single content tree.

- Home
    - About-Us
        - Board-Members  
    - Contact-Us

We have three hostnames defined in umbraco to go to this single tree.

  • example.com -> en-US
  • en-ca.example.com -> en-CA
  • ja-jp.example.com -> ja-JP

Using Vorto we are able to manage the content in those three languages/cultures and we are seeing the proper content based on the current culture when we navigate the site. All good.

Let us say that the we have a requirement that the Board-Members page cannot be accessible in the ja-jp culture. So, the item exists in the tree, but we want to prune it out from generated menus and totally prevent the page from being rendered in the ja-jp.example.com domain.

Now, I understand that this isn't a Vorto issue. We can add a checkbox list data type with some prevalues of the cultures we have. Then, the editor would specify which cultures the item is available in. Then, leveraging some Umbraco events we can prevent the rendering of the Board-Members page to the ja-jp.example.com domain. All good.

However, there is a Vorto usability issue in that the editor is presented with the ability to translate to Japanese even though they specified that the Board-Members item shouldn't be available to the ja-jp culture. In my scenario, I'd like to have Vorto not show ja-JP as an option for the Board-Members item even though ja-JP is configured with the Umbraco hostnames. In this example we are dealing with only three total languages and filtering one. In reality, we will have many more languages.

I hope this helps clarify my requirement.

from umbraco-vorto.

mattbrailsford avatar mattbrailsford commented on August 30, 2024

Ok, the issue sounds very specific to your requirements, however, maybe I can put an event in place to allow you to filter the languages yourself before they are passed to the view, this way you could implement your own custom logic to filter the list further at run time. Would that suffice?

Matt

from umbraco-vorto.

seankearney avatar seankearney commented on August 30, 2024

I think that could work!

from umbraco-vorto.

mattbrailsford avatar mattbrailsford commented on August 30, 2024

Just released version 1.2 which now includes a custom event so you can filter languages further. In an application handler, just do something like:

Vorto.FilterLanguages += (sender, args) =>
{
    args.Languages.RemoveAll(x => x.IsoCode.Contains("da"));
};

args contains a list of languages about to be returned, along with the CurrentPageId and ParentPageId (need both as CurrentPageId will be empty on initial page creation so usually best to work out the filter based on parent page) so just modify the list as you wish.

from umbraco-vorto.

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.