Internationalization #578
Replies: 18 comments 1 reply
|
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 |
|
Certainly keeping an eye on this thread, as I'm trying jigsaw for a simple project and I like its workflow. Structuring the files for a multilingual site, with different content types, has been certainly a challenge. After reading all the thread, I see this issue is still open and attracts attention. @damiani Is there a roadmap for this? |
|
Hello guys 👋🏽 checkout the library Jigsaw Localization that I have just released. I am excited to get some feedback and see it being useful you |
|
I implemented some level of internationalization on my Jigsaw project. You can see it at https://gitlab.com/islam-answers/website/-/tree/c9b999bbd2c2634a1c098206395884196f3c4930/app My directory structure looks like this: The only thing I wish I could fix is using the same filename for posts in different language directories. #674 (comment) To workaround this, right now I'm adding a language suffix to filenames (my-post-title.en.blade.md) I had to add some helpers to make things work, so you might find that interesting to look at, too. https://gitlab.com/islam-answers/website/-/blob/c9b999bbd2c2634a1c098206395884196f3c4930/app/config.php I linked to a specific commit because I'm soon integrating Lokalise, and I might update the implementation to make it work better with Lokalise. |


Uh oh!
There was an error while loading. Please reload this page.
Would be cool also to be able to use the
trans()helper to load translated content within a static site also...All reactions