-
Notifications
You must be signed in to change notification settings - Fork 181
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
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
Internationalization #25
Comments
I know this is old but I think this hasn't been addressed yet and it is preventing me from using Jigsaw in a lot of projects :( Any idea to work something out with current implementation of Jigsaw? Any idea if this is ever gonna be solved? Thank you! |
Yes, it's the most-requested feature at the moment! Can you give a little more detail about what your needs are? We'd need to sort out how to define the current locale, presumably by specifying a language code as part of the URI; and then perhaps indicating which languages to use for a particular template by specifying the language codes in the YAML front matter of the template. |
Oh, this is really great to hear! I guess my needs are quite simple, nothing fancy:
FYI I've been using LaravelLocalization since before Laravel introduced its custom translation system and it's been great. Actually way better than the built-in system. Thank you :) and thanks for your quick response. |
We're gonna be working on this feature soon, and would love to get input on what people think would be the most useful and user-friendly way to handle internationalization. Keeping close to Laravel's implementation of things like |
Hi, I personally like to use I really like the way Laravel let's users choose their own directory structure inside For the folks that use |
You can somewhat do this already, and in fact I wonder if having language as a collection isn't really the best solution for an internationalized site—considering that the number of languages is likely small, not subject to frequent change, and doesn't require many of the features that collections is designed to provide (you don't generally need to do things like change the sort order of languages, see a paginated subset of languages, count them, etc.). I'm not opposed to considering the concept of nested collections, but it would be worth considering other scenarios where that would be useful, before we go down that road. To do what you outlined above, you could do something like this. In <?php
return [
'baseUrl' => 'https://example.com',
'path' => '{language}/{type}/{-title}',
'collections' => [
'posts-sl' => [
'type' => 'blog',
'language' => 'sl',
],
'posts-en' => [
'type' => 'blog',
'language' => 'en',
],
],
]; ...and then store your translated blog posts in which would build to this: Note that I'm using I threw in non-collection translated pages as well, So you'd end up with:
The issues I'd like to sort out are:
|
@damiani Your proposition perfectly describes my use case! Also, actually including Slovene text in them, made me laugh. You've made my day again :) |
Hi again, I'm giving it a try and outlining my concerns once tested. But I think that, using this approach, there's no way I could provide a user (ang Google) the alternative lang link (i.e. But just as I said, i'll give it a go and come back with some ideas or feedback. |
@morpheus7CS Blame Google for any translation errors :) @afontcu Yes, please report back with your thoughts. You could have alternative links for users/Google pretty easily if you weren't customizing the blog post title by language (i.e. |
Hi there! Been testing the approach outlined above and while it covers 80% of the requirements of a translated site, there are some important flaws:
Thank you very much! |
I was thinking about pagedata which has an array of locales to render the page in. This locale property can later on be used in url generators and as a parameter for the illuminate/translation provided translator. |
I'm also building a multi-locale site, and realized that you can include
Then you can define a 'master' layout for each page (e.g. about-us, services, home), an extend the layout specifying only page metadata. For example, you can have a master 'about-us' layout in
And locale-specific pages in
and
With this setup, translation strings can be organized in the same way as in a regular Laravel project. This is something that I only quickly tested, and it works. I'm not sure how slow the build will get with more translation strings - it can probaly be optimized by loading |
I like both approaches, but in @amadeann's approach: what if you want to translate a whole post with HTML inside (e.g. for formatting)? Do you keep all that in the translation strings? |
If the formatting is very different between languages, and the layout changes as well, then just create separate pages. If you need minor formatting (like wrapping some text in |
I followed @damiani 's suggestions, but how do you access the blog posts then? If the blog is just called |
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
Would be cool also to be able to use the
trans()
helper to load translated content within a static site also...The text was updated successfully, but these errors were encountered: