-
Notifications
You must be signed in to change notification settings - Fork 813
Update adding-language-variants.md #6360
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Added some support for setting cultures in API calls
|
Thanks for the PR, @jonathoncove2 🙌 We will review it as soon as we can. 💪 |
|
Thanks for the PR @jonathoncove2 ! 💪 The "Creating a basic site" tutorial is meant to be very high-level and shouldn't dive into more code than the cshtml and CSS files. |
|
Thanks for looking over this @sofietoft ! I agree that page is a more suitable place for this code. Would you prefer me to make a new PR for this? I also considered some example code showing how to add a language switching menu, would that be a useful addition? |
|
Excellent! It would be amazing with a language switcher 👏 The "Create a multilingual site" tutorial is a bit long and messy at the moment. |
Added a guide for creating a basic language switching navigation
|
I've removed that API example as requested and added a language switcher. Not sure if my link from adding-language-variants.md works correctly, that might need to be fixed. I've also added sub headers, hopefully to guide users googling the same things I was. I'm about to go on holiday for a week and half, but feel free to Umbraco-ify the PR and approve it while I'm away. |
|
Amazing @jonathoncove2 ! Have a wonderful holiday 🏖️ |
Frost117
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jonathoncove2 I made some comments about the ILocalizationService, do you think you can rewrite the part but using the ILanguage service instead?
| ```csharp | ||
| public class ExampleController : SurfaceController | ||
| { | ||
| private readonly ILocalizationService _localizationService; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The ILocalizationService is currently marked as obsolete and will be removed in v15. If we decide to keep this one, we have to include a note that the above is obsolete.
Preferably, make this example use the ILanguageService instead
|
|
||
| public IActionResult Index(string culture = null) | ||
| { | ||
| IEnumerable<ILanguage> UmbracoLanguages = _localizationService.GetAllLanguages(); //a helpful method to get all configured languages |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Something like this could be used instead of calling the database:
https://apidocs.umbraco.com/v14/csharp/api/Umbraco.Cms.Core.Services.ILanguageService.html#Umbraco_Cms_Core_Services_ILanguageService_GetAllAsync
|
|
||
| #Getting all the languages for a site | ||
|
|
||
| There are two ways to achive this. One is to use ```localizationService.GetAllLanguages();``` to call the database, which is expensive and ideally includes caching. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could still keep this part, but instead it would be 3 ways to get the languages.
Then show of each with the not that the localizationService very expensive to do and should only be done if you cannot use the ILanguage service
|
Hello @jonathoncove2 👋 Did you notice the review on your PR here? 😄 |
…rvice Updated the v10 docs to use the original example, as language service is not available
|
@sofietoft so sorry about the late response to this. I've updated the example as suggested, and added the original example to the v10 docs, as the original example is still the most appropriate for that version. I'm not sure when ILanguageService became available, so it might be best to add it to a lower version, you guys will know better than me on that one! |
|
Perfect, thanks @jonathoncove2 ! 💪 I'll make sure our developer give this a second review. |
Frost117
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good with the v14 and the updated LanguageService 😃
sofietoft
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've taken the liberty to fix some grammar issues and some typos.
I've also fixed a couple of lists, where each item didn't start with the action word, which prefer 🙌
I was wondering if you could put the steps in the Steps section into an ordered list? Since they are steps, I think it would be nice to format them as such as well 😄
Finally, I've made a suggestion!
I hope it all makes sense. Let me know if something doesn't 💪
|
|
||
| You need to replace `{{homeNodeContentAlias}}` with the Document Type alias of your Home node. | ||
|
|
||
| This will look at all the cultures available on the home node, and render links to either the language variant of the current page or the home node for the language variant. If the home node for a language variant is removed, it will not appear in the list. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A suggestion to shorten this sentence a bit.
| This will look at all the cultures available on the home node, and render links to either the language variant of the current page or the home node for the language variant. If the home node for a language variant is removed, it will not appear in the list. | |
| This will look at all the cultures available on the home node. Links to either the language variant of the current page or the home node for the language variant will be rendered. If the home node for a language variant is removed, it will not appear in the list. |
Shortened a sentence
|
Thanks Sophie! Looks like I rely on spell checkers too much 🙈 I've made the changes as you requested |
|
Looks great @jonathoncove2 ! 😄 I'lle get this merged as soon as the check clears 🙌 |
|
Thanks @sofietoft ! |
Added some support for setting cultures in API calls
Description
What did you add/update/change?
Type of suggestion
Product & version (if relevant)
Deadline (if relevant)
When should the content be published?