#LanguageSwitcher
Explore tagged Tumblr posts
Text
In today's globalized world, websites need to support multiple languages to reach a wider audience. Laravel 12 provides built-in localization features that allow developers to create multi-language websites efficiently. This tutorial will guide you through setting up a multi-language website in Laravel 12 using language files, middleware, and dynamic content translation.
#Laravel12#MultiLanguage#Laravel#WebDevelopment#Localization#Internationalization#LaravelDevelopment#PHP#LaravelApp#MultiLanguageWebsite#WebsiteLocalization#BackendDevelopment#WebAppDevelopment#PHPFramework#LocalizationInLaravel#Translation#LaravelLocalization#LaravelTips#MultiLingualSupport#WebAppFeatures#LaravelBestPractices#MultiLanguageSupport#LaravelTutorial#LaravelProjects#LanguageSwitcher#FrontendBackendIntegration#WebAppArchitecture
0 notes
Text
(Mature) A Taste of the Night Switch Eren Yeager x reader TW: oral (reader receiving), unprotected sex, fingering, foul languageSwitch deprived virgin Eren x gender neutral reader (Mature Content) Guys I found this playlist it is very underrated. If you like Eren, check it out. https://youtu.be/zZ-LmC5_OjI Eren Yeager. Your hero. It wasn’t his fault he was a titan, but everyone treated him as a monster, even though he had shown his loyalty time and time again, serving the scouts. They kept him in a dungeon. It looked normal enough, but perhaps it was slightly titan proof. They feared him, but trapping him wasn’t going to make him more likely to help their cause. No doubt if he wanted to, he would easily have destroyed the place by turning into a titan. “You can’t be too careful,” people said, whenever talking about him. Some, the religious, crossed themselves in his presence or when talking about him. This imprisonment isn’t careful, it's stupidity. You always thought that. Eren was treated like an animal, only let out of his cage when they needed him for something, which, most of the time, was for fighting, and the other part was interrogation. He never had any leisure time, only staring at the walls of his cell, thinking of who knows what. You were often the person sent down to give him his meals, or supervise during baths, though you didn’t look at him. There were always one or two guards, too, staring him down as if he would do something any minute. He could, but you knew he wouldn’t. Just because a king has the power to kill innocent people, if they are a good ruler, they’ll try not to. When you gave him his food, which you were often told to do, since you were one of the few people not terrified by his existence. You always slipped notes in from his friends with the napkins, sometimes writing on the undersides yourself, telling him to bear it, keep up the good effort, what a great person he was. If he ever actually got to read any of it, you didn’t know, considering how the guards always watched. He always slipped them under his pillow case before the sentries could see the writing. Perhaps he pretended to sleep while actually reading them. After working for the scouts, being kind, everyone trusted you. This was his one night of release, where he could leave the cell and do anything he wanted. As a ‘gift’, they let him out for 8 hours. Something others would take for granted, thinking nothing of it. Night, not day. It made people much less likely to notice him. You were told to secretly guard him, report back if he did anything suspicious. You wouldn’t tell on him, no way, no matter what he did, but if they were giving you permission to go follow him on his one day to keep secrets, you were going to see what he was up to. The sun was down, and the sky was dark. You gave the signal. The guard unlocked the gate, and Eren stretched, and slowly walked out of the door, as if a house cat, seeing the door open for the first time, the possibility of the outdoors calling. From there, cautious, he set a fast pace of walking away. You followed him out of the barracks, and he seemed to have a place in mind of where he was going. You almost lost him a couple times, a combination of his fast walking and you trying to be stealthy. You had borrowed a plain scout cape with a hood on it, concealing you. You saw him duck into a bar, and you stopped your feet, disappointed, but not entirely surprised. Wasn’t he 19? Could he even drink? You shook your head. If you were in his situation, wouldn’t the first thing you’d do is go and get drunk? You walked in cautiously, if they hadn’t stopped him, they wouldn’t stop you. Everyone stopped to stare at you, and you looked around. Eren wasn’t there. How did he give you the slip? You turned back around, headed out, and bumped into someone. They were so close, they must have been an inch or two behind you as you were walking in. “Boo.” He said. You looked up, and it was Eren. He flipped your hood, revealing who you were. He pressed you against the gray stone wall as a couple walked into the
bar, their faces in shadows. He took his hand off your mouth, instead grabbed your hand, and pulled you with him. He started walking, slower this time, allowing you to easily keep up. “I knew they’d send someone after me. Pointless to try to hide. ” Instead of being angry, he replied, “I suppose I can’t put it past you for following orders. Well then, be my guest. Follow me all night. I’d much rather have you than another guard. Who knows, maybe we can do something fun.” He put an earbud in the ear opposite from you. Where did he possibly get that? What was it attached to? Was he communicating with someone? You realized that you had stopped walking, and he was looking back at you, gently pulling on your arm. “Come on, I don’t have all day,” he complained. You apologized, and kept up. You heard some loud music, the beat dropping hard, it was blaring, but quiet to you. You looked around, and saw nothing. It sounded far off. You realized that it must have been coming from his earbud. “You’re going to lose your hearing, like that,” you muttered quietly. “Maybe,” he hummed. “But I heal so quickly, I doubt it.” You walked a bit, and he stopped in front of a house. He opened it, and stepped aside for you to enter. Was this his? It was small, and looked like it had been recently cleaned, but no one lived here, since the place wasn’t decorated at all, and the only furniture was a dresser, a lamp, and a bed. There wasn’t even a fridge or television. He shut the door and locked it. Should that be a red flag? He pulls open the dresser, and you try and peer in, but he pushes you away. He takes a bottle of something, probably wine, out, and lays it on the top of the dresser. “You can have some, if you want. It doesn’t work on me, as much as I wish it did. You take the bottle in your hands, turning it over. Maybe later. “Come on, hurry up. We don’t have very much time. I only have a night off.” He pauses, his shirt halfway off. What is he doing? You can see his nipples. You look away, blush flooding your cheeks. You had just wanted to talk, but if he wanted to do this instead, could you say no? You had never thought of him in a sexual way, but now that you looked, probably the only thing he could do in that cell was exercise, push ups and sit-ups. It showed on his body. His dark hair was messy and long, no one had bothered to help him with it. It wasn’t too bad, though. Under his eyes, lines showing that he had recently been in titan form. Every second, they faded a little bit more. In a couple hours, they’d be gone. His eyes were halfway closed, and you could tell he was thinking bad thoughts. He sighed, a breathy, needy sound. The noise made its way down to your core, and you were sure your cheeks were flaming. He sat you down on the bed. “You were the only one that was kind to me, this whole time I'd been there. Even my friends can't visit me. Please, let me return the favor. If not, I’ll just take matters into my own hands.” His hand traveled up your leg, but you flinched away from him. His eyes hardened, disappointed. “Fine, be like that. But if you don’t want me, then have the decency to act like it. Yes or no, I’m still having a good time tonight.” You looked down at his crotch, if he was this horny, then, how long had he been planning this? Did he know you liked him that much? You felt your underwear was no longer dry. “No, don’t worry about me. I can take care of myself later. I just want to taste you. Eat you. Please, let me. I can’t tell you how many times I’ve had to resist grabbing your wrist and keeping you in the cell with me. But I couldn't do that. It’d put you in danger, since you would be with me. It has to be a secret. You are my candle in the darkness.” On his knees, he has fully taken off his shirt, and you can’t help but stare. He grabs your hips. “Please, I need you.” You cracked. “Of course, I’d do anything for you. I’m just surprised you’d want to please me instead of yourself.” The words slipped out of your mouth. “Don’t think so lowly of me.” He growled. “I recently. Turned 19. A whole year being
legal, and I wasn’t able to do anything that whole damn time. I was so desperate for someone.” He slid down your bottoms and gently took off your underwear. He thrust a finger in your hole and you cried out. "S-sorry. I… haven't done this before." You guided his fingers, and he had you feeling good in no time. He seemed so desperate to learn, to make you feel better. You could feel that you were close. He must have seen something on your face that gave it away, or perhaps it was the way you squeezed around his fingers when they slid out. He placed his mouth between your thighs, and you felt his hot breath hit you. He was staring, a starved man waiting for the prayer to be over, to finally be allowed a meal. You held the back of his head and pushed him towards you. He didn't hesitate, he stuck out his tongue and went at it like a pro. You couldn't help the noises that came out of your mouth. Even better, he really seemed to be genuinely enjoying it too. When you came, he gulped it down. He stayed there, at your knees, staring up at you, as if wanting more. "Want to… actually… do it?" You put the offer out there. "If you really want. Are you sure? I might not be able to help myself-“ you cut him off. “Yes, please, I want you. You’re my idol, Eren. You don't know how much you mean to me.” He pushed you into the bed and suffocated you with his kisses. You had never dreamed you’d end up like this with such an amazing person. He let out a couple of loud huffs as you sat on his lap, slowly taking him in. “Damn, I’m already- fuck, I don’t think we should do this. I might spend my whole night like this uhf.” His words were stopped as you rocked gently on him. “I’m warning you, if you don’t get off right now, I’m going to do something that’s your fault.” You just kept doing it, enjoying him underneath you. He was probably a virgin, never having the chance of doing stuff before. However, he was obviously well educated. “Go ahead, I don’t mind.” He brought his face up to your ear, and you felt his body rubbing against you. He huffed in your ear, and slowly fell still under you, and let out a shameless moan in your ear as he released, trembling. He clutched you tight, knocking your breath out, and gently lessening his pressure on you until he was hugging you gently. “That was so fast. I wasn’t expecting that. I have all night. I wonder how many times you can make me do that. I've never felt like that before, never done that, but you felt so good. I need more, baby.” Your hands were all over each other, grabbing, needy. Knowing you might not be allowed again, perhaps ever. Every second you were together, you got wetter, everything he did, sexy. He would never have a supervised bath that you weren’t staring at ever again. He spent most of the night shoving you into the mattress, fucking you from all the positions you wanted to try. In total, he made you cum four times, and he did at least twice that many. You were drained, but happy, when the sun rose, and he walked back into the barracks. You followed about five minutes later. “So, how was he?” Your supervisor whispered to you later in the day, after allowing you time to rest. “He didn’t do anything I wouldn’t approve of, sir.” You answered truthfully. “Well, I’ll be damned. Who knew? Perhaps we should give him more free time after all.” #erenxreader #erenxreader#erenyeager
#erenjaeger
#aot
#smut
#erenyaeger
#erenyeager
#aotsmut
#anime
#aotxreader
#erenxreader
6 notes
·
View notes
Text
Sitecore, Solr, and Many languages
Sitecore 7 added a content search API to interact with Lucene and Solr. I'm sure anyone who has ever worked with search will tell you that search is hard, as it requires a lot of customisation that is entirely per-site, and what works for someone else might not work for you.
I'm here to tell you what worked for me, a really specific use case involving Sitecore 8.1 update 4, Apache Solr 6.2, and searching 7 regions with 4 different languages.
We're using some internal libraries on top of the content search API, but they eventually make the same calls as everyone else.
We started out with a fairly standard content search, which... mostly worked, even across languages. Condensed form:
var context = SearchIndex.CreateSearchContext(); var query = context.GetQueryable<oursearchresults>(); query.Content.Like(queryArgs);
There are actually a few issues with this approach:
The way our site is set up, 90% of the content we care about is actually in an item's components, not on the item itself.
This treats all languages the same way. Sitecore will send the same query to solr no matter the language being searched: _content:(*queryArgs*)
This will only give exact matches (even though .Like() is used)
Issue 1 is solved with a computed index field.
public class VisualizationField : MediaItemContentExtractor { public override object ComputeFieldValue(IIndexable indexable) { string baseValue = base.ComputeFieldValue(indexable) as string; Item indexItem = indexable as SitecoreIndexableItem; if (!ShouldIndexItem(indexItem)) { return baseValue; } var dataSources = Globals.LinkDatabase .GetReferences(indexItem) .Where(link => ShouldProcessLink(link, indexItem)) .Select(link => link.GetTargetItem()) .Where(targetItem => targetItem != null && targetItem.Versions.Count > 0) .Distinct(); var result = new StringBuilder(); if (!string.IsNullOrEmpty(baseValue)) { result.AppendLine(baseValue); } foreach (var dataSource in dataSources.Where(ShouldIndexDataSource)) { dataSource.Fields.ReadAll(); foreach (var field in dataSource.Fields.Where(ShouldIndexField)) { result.AppendLine(field.Value); } } return result.ToString(); } }
The ShouldProcess and ShouldIndex methods check to see whether or not something is actually related, and whether or not something should be put into the solr index based on some pretty basic parameters (correct content type, whether or not the component is actually being rendered).
Issue 2 caused me a great deal of stress until I stumbled across a blog post from the Sitecore 7 era. Sitecore added the concept of CultureExecutionContexts, which is a really fancy way of saying you can tell Sitecore to send over a search for content_t_{lang} instead of just _content by using this:
var context = SearchIndex.CreateSearchContext(); var culture = new CultureInfo(Sitecore.Context.Language.Name); var cultureCtx = new CultureExecutionContext(culture); var query = context.GetQueryable<oursearchresults>(cultureCtx); query.Content.Like(queryArgs);
And now your solr queries will look like this:
`content_t_{lang}:(*queryArgs*)`
Huzzah! You're searching specific languages! The problem quickly becomes, now you're doing language-specific exact match queries, which isn't very helpful.
Enter stemming algorithms.
The basic idea is that you give solr a word like engineer, and it boils the word down to the word's stem, so that you can run queries like engineer, engineers, engineered, or engineering and it will give you the same results. There are stemmers for basically every language you can think of, and the solr documentation explains how to use them far better than I ever could. The example schema.xml file generated by Sitecore actually contains basic analyzers that work fairly well. You will likely want to tweak them to fit your needs, but for an out-of-the-box solution, they work.
Once you've put the correct analyzers in place, restarted solr (this is important, solr does not pick up schema changes on the fly), and reindexed, you should now be getting decent search results in multiple languages.
Now is when language-specifics come into play. One of the languages this client supports is Polish, which does not come with out-of-the-box support from solr. Thankfully, there are already instructions for how to set that up.
The problem language for us, so far, has been German. German is what's known as a fusional language, which means that they tend to make new words by shoving old ones together. For instance, the German word for engineer is "ingenieur" and the word for civil engineer is "bauingenieur." This creates an issue for our search purposes, as "bauingenieur" and "ingenieur" should both return results for "ingenieur." The problem is solved with the Dictionary Compound Word Token Filter, a solr filter that will break words like bauingenieur down into their components "bau" and "ingenieur," so your results become what you'd expect. This requires a German word list, which can be a bit tricky to find, but once you have it, it works beautifully.
At this point, our search results have become downright useful and accurate (though we haven't implemented nice-to-haves like spellchecking and synonym searches), but there's a subtle bug. Sitecore isn't sending over the _content field to solr for each individual language properly. If your setup is like ours, with a very thin item and all of the pertinent content in subcomponents, the _content field in the index is going to be very sparse, basically containing nothing but the content in the top level item itself.
This is a subtle bug, and one that took several hours of debugging and someone far more versed in Sitecore than me to finally solve, but the issue is in the computed index field for the _content field.
var dataSources = Globals.LinkDatabase .GetReferences(indexItem) .Where(link => ShouldProcessLink(link, indexItem)) .Select(link => link.GetTargetItem()) .Where(targetItem => targetItem != null && targetItem.Versions.Count > 0) .Distinct();
This code will only get the components in Sitecore's default language. The rest of the code will properly put the correct language content from the top-level item into the index, but one of the checks it makes is whether or not a component is in the layout of that item in that version and language. If you have an item that only exists in the default Sitecore language, this works fine, but for any other language it's not going to get any of the subcomponents.
I haven't found any documentation about this, but the solution that is working for us is bringing in a LanguageSwitcher:
using (var switcher = new LanguageSwitcher(indexItem.Language)) { public class VisualizationField : MediaItemContentExtractor { public override object ComputeFieldValue(IIndexable indexable) { string baseValue = base.ComputeFieldValue(indexable) as string; Item indexItem = indexable as SitecoreIndexableItem; if (!ShouldIndexItem(indexItem)) { return baseValue; } var dataSources = Globals.LinkDatabase .GetReferences(indexItem) .Where(link => ShouldProcessLink(link, indexItem)) .Select(link => link.GetTargetItem()) .Where(targetItem => targetItem != null && targetItem.Versions.Count > 0) .Distinct(); var result = new StringBuilder(); if (!string.IsNullOrEmpty(baseValue)) { result.AppendLine(baseValue); } foreach (var dataSource in dataSources.Where(ShouldIndexDataSource)) { dataSource.Fields.ReadAll(); foreach (var field in dataSource.Fields.Where(ShouldIndexField)) { result.AppendLine(field.Value); } } return result.ToString(); } } }
Once you rebuild and reindex with the proper computed index field, your components will be properly indexed, your search results correct, and, hopefully, your clients happy.
0 notes