Archive for January 2025

Using i18n Trans with custom components

React/Next.Js/Javascript page const currency = €; const { t } = useTranslation(); <Trans t={t} i18nKey={’Path.To.Mykey’} components={{ customspantorender: <Customspan currency={currency} />, }} /> Customspan.tsx import React from ‘react’;   const Customspan = ({ currency }) => { const amount = 15.99; return ( <span>{currency} {amount}</span> ); }; export default Customspan; sample.json "Path": { "To": { "Mykey": […]

Redirection types

301 – Permanently Move (Simple Redirect Post plugin does this) 302 – Temporarily Move 307 – Temporarily Redirect

How to team Laravel api with Next.Js within same domain name

Initial configuration: Laravel 7.x folder: /var/www/laravel Next.Js folder: /var/www/public_html Step 1. Add your api response to laravel Add to /var/www/routes/web.php Add to /var/www/app/Http/Controllers/IndexController.php Step 2. Add api/ folder to Next.Js public folder. Don’t touch existing Next.Js static html files Move /var/www/laravel/public/index.php to /var/www/public_html/api Then edit it, change the following: Move /var/www/laravel/public/.htaccess to /var/www/public_html/api, no need […]