Skip to main content

Posts

Adding Internationalization (i18n) in FastAPI

🌍 Adding Internationalization (i18n) in FastAPI If you're building a multi-lingual API with FastAPI, it's essential to support internationalization. In this guide, we'll use the python-i18n library — a simple and effective tool for managing translations in Python using JSON files. πŸ“¦ Step 1: Install python-i18n pip install python-i18n πŸ“ Step 2: Create Locale Files Create a locales directory and add your language JSON files: locales/ ├── en.json └── fr.json en.json: { "greeting": "Hello" } fr.json: { "greeting": "Bonjour" } ⚙️ Step 3: Configure i18n in FastAPI import i18n from fastapi import FastAPI, Request app = FastAPI() # Load translation files i18n.load_path.append('locales') i18n.set('fallback', 'en') 🌐 Step 4: Detect Language from Request @app.middleware("http") async def add_language_to_request(request: Request, call_next): lang = request.headers.get(...
Recent posts

Show Your Work! — Coin-Size Summary

Theme: You don’t need to be a genius — just be generous and share your process. Core Message: “People can’t find you if you don’t let them see you.” Key Ideas: Share your process, not just the polished product. Be an amateur — open, curious, and always learning. Teach what you know , and build trust by showing up consistently. Don’t wait to be “ready” — sharing builds confidence and community. 10 Short Rules (Examples): You don’t have to be a genius. Think process, not product. Share something small every day. Stick around. Core Lesson: “Being good at something is no substitute for showing up and sharing it.”

The Practice — Coin-Size Summary

  Theme: Creative confidence comes from consistent action, not talent or inspiration. Key Belief: “Do the work. Ship it. Repeat.” Ideas That Stick: Trust the process — creativity is a habit, not a gift. Shipping work (publishing, releasing) builds momentum and confidence. Make things better by making better things — improve through iteration. You don’t need permission — show up and contribute. Message: “Creativity is not a feeling. It’s a choice to act with intention.” Core Lesson: “The only way to be creative is to begin. The only way to begin is to show up.”

Can’t Hurt Me — Coin-Size Summary

  Theme: Mental toughness is earned by embracing pain, discipline, and relentless effort. Core Conflict: Goggins vs. his traumatic past, inner weakness, and physical limits. Key Concepts: The 40% Rule: When you think you’re done, you’re only at 40%. Accountability Mirror: Be brutally honest with yourself. Calloused Mind: Repeated hardship builds inner strength. Message: “You are in control of your mind. You just have to own it.” Tone: Gritty, intense, no-excuses. It’s less about motivation and more about transformation through discomfort. Core Lesson: “You will never learn from people if you always tap dance around the truth.”

Mindset — Coin-Size Summary

  Theme: Your beliefs about ability shape your success. Two Mindsets: Fixed Mindset: “I’m either good at this or I’m not.” Growth Mindset: “I can improve with effort and learning.” Key Message: Talent matters, but belief in learning and persistence matters more. Applications: Work: View challenges as growth opportunities. Product: Embrace feedback and iteration. Life: Progress comes from effort, not perfection. Core Lesson: “Becoming is better than being.”

The War of Art — Coin-Size Summary

  Theme: The inner battle every creator faces. Enemy: Resistance — fear, procrastination, self-doubt. Message: You are your own biggest obstacle. Show up, do the work, and overcome Resistance daily. Structure: Book 1: Defines Resistance and how it sabotages creative work. Book 2: Encourages turning pro — approaching your work with discipline, not emotion. Book 3: Taps into inspiration as a reward for consistent effort. Core Lesson: “The amateur waits for inspiration; the pro shows up and works.”

Rethinking Writing Assistants: A Fresh Opportunity in macOS Productivity

In a world full of grammar checkers, writing enhancers, and AI-powered editors, one question remains surprisingly unanswered: why hasn’t anyone built a truly seamless, intelligent writing assistant for macOS that combines next-word prediction with real-time rewriting? The Current Landscape Today’s macOS users have several writing tools to choose from: Compose for macOS: Offers shortcut-activated rewriting, grammar correction, and text shortening in any app. However, it doesn’t predict your next word or sentence. Apple Writing Tools (macOS Sequoia): System-level rewriting, tone adjustment, and proofreading. Great polish, but still reactive rather than proactive. Fixkey: Adds voice-to-text and real-time rewriting with support for multiple languages. GrammarPaw: Lightweight and powerful, with ChatGPT integration, but requires manual activation for each rewrite. Cotypist: Possibly the closest to predictive text—offers GitHub Copilot-style autocomplete across macOS apps, but lacks grammar...