Editing: /home/goacom/public_html/scratch_extract/lang.php
<?php /** * lang.php — Site-wide translation helper * Include this file at the top of every frontend page (after $pdo is set up). * * Usage: * __('sidebar.promotion') → "প্রচার" (bn) or "Promotion" (en) * __('footer.home') → "হোম" (bn) or "Home" (en) * __('sidebar.deposit') → "জমা" (bn) or "Deposit" (en) */ // --------------------------------------------------------------------------- // 1. Detect active language from the settings table (cached in session) // --------------------------------------------------------------------------- if (!isset($_SESSION['site_lang'])) { $site_lang = 'en'; // fallback default if (isset($pdo)) { try { $ls = $pdo->query("SELECT site_lang FROM settings LIMIT 1")->fetch(); if ($ls && !empty($ls['site_lang'])) { $site_lang = $ls['site_lang']; } } catch (Exception $e) { // settings table or column doesn't exist yet — use 'en' } } $_SESSION['site_lang'] = $site_lang; } $GLOBALS['_site_lang'] = $_SESSION['site_lang']; // --------------------------------------------------------------------------- // 2. Load the correct translation table // --------------------------------------------------------------------------- $_translations_en = [ // ── Sidebar ────────────────────────────────────────────────────────── 'sidebar.promotion' => 'Promotion', 'sidebar.withdraw' => 'Withdrawal', 'sidebar.inviteFriends' => 'Invite Friends', 'sidebar.rewardCenter' => 'Reward Center', 'sidebar.gameCenter' => 'Game Center', 'sidebar.slots' => 'Slots', 'sidebar.liveCasino' => 'Live Casino', 'sidebar.fish' => 'Fish', 'sidebar.sports' => 'Sports', 'sidebar.cricket' => 'Cricket', 'sidebar.tennis' => 'Tennis', 'sidebar.football' => 'Football', 'sidebar.other' => 'Other', 'sidebar.eGame' => 'E-Game', 'sidebar.poker' => 'Poker', 'sidebar.all' => 'All', 'sidebar.slot' => 'Slot', 'sidebar.account' => 'Account', 'sidebar.cashback' => 'Cashback', 'sidebar.vipCenter' => 'VIP Center', 'sidebar.bettingRecord' => 'Betting Record', 'sidebar.accountRecord' => 'Account Record', 'sidebar.securityCenter' => 'Security Center', 'sidebar.depositRecord' => 'Deposit Record', 'sidebar.profitLoss' => 'Profit & Loss', 'sidebar.mail' => 'Mail', 'sidebar.downloadApp' => 'Download App', 'sidebar.customerService' => 'Customer Service', 'sidebar.helpCenter' => 'Help Center', 'sidebar.language' => 'Language', 'sidebar.turnover' => 'Turnover', 'sidebar.openBets' => 'Open Bets', 'sidebar.depositHistory' => 'Deposit History', 'sidebar.logOut' => 'Log Out', 'sidebar.shareEarn' => 'Share & Earn', 'sidebar.deposit' => 'Deposit', 'sidebar.sharesAndEarnings'=> 'Shares and earnings', 'sidebar.playCenter' => 'Play center', 'sidebar.inviteFriendsBtn' => 'Invite friends', 'sidebar.downloadTheApp' => 'Download the app', 'sidebar.customerServiceBtn'=> 'Customer service', 'sidebar.submissionHistory'=> 'Submission history', 'sidebar.lifting' => 'Lifting', 'sidebar.openBet' => 'Open Bet', // ── Footer ─────────────────────────────────────────────────────────── 'footer.home' => 'Home', 'footer.promotion' => 'Promotion', 'footer.share' => 'Share', 'footer.reward' => 'Reward', 'footer.account' => 'Account', // ── Header / Navigation ────────────────────────────────────────────── 'header.login' => 'Log In', 'header.register' => 'Register', 'header.getBonus' => 'Get Bonus', // ── Login / Register page ──────────────────────────────────────────── 'login.logIn' => 'Log In', 'login.register' => 'Register', 'login.username' => 'Username', 'login.mobile' => 'Mobile Number', 'login.password' => 'Password', 'login.pin' => 'PIN', 'login.confirmPassword' => 'Confirm Password', 'login.referralCode' => 'Referral Code', 'login.optional' => '(Optional)', 'login.remember' => 'Remember me', 'login.forgotPassword' => 'Forgot Password?', 'login.loggingIn' => 'Logging in...', 'login.registering' => 'Registering...', 'login.noAccount' => "Don't have an account yet?", 'login.haveAccount' => 'Already have an account?', 'login.passwordNotMatch' => 'Passwords do not match', 'login.getStarted' => 'Get Started', 'login.welcome' => 'Welcome back', 'login.signUpNow' => 'Sign up now', // ── Index page (landing) ───────────────────────────────────────────── 'index.welcomeTitle' => 'Welcome to MELBETE', 'index.welcomeSubtitle' => 'The Best Online Gaming & Betting Platform', 'index.loginBtn' => 'Log In', 'index.registerBtn' => 'Register', 'index.getFreeBonus' => 'Get free bonus', 'index.playNow' => 'Play Now', 'index.joinNow' => 'Join Now', // ── Dashboard ──────────────────────────────────────────────────────── 'dashboard.total' => 'Total', 'dashboard.seeAll' => 'See All', 'dashboard.searchGames' => 'Search Games...', 'dashboard.deposit' => 'Deposit', 'dashboard.withdrawal' => 'Withdrawal', 'dashboard.share' => 'Share', 'dashboard.noFavorites' => 'No favorites yet', 'dashboard.addFavorites' => 'Tap the ♡ on any game to add it here.', 'dashboard.logOut' => 'Log Out', // ── Account page ───────────────────────────────────────────────────── 'account.myAccount' => 'My Account', 'account.nickname' => 'Nickname', 'account.deposit' => 'Deposit', 'account.withdrawal' => 'Withdrawal', 'account.myCards' => 'My Cards', 'account.memberCenter' => 'Member Center', 'account.rewardCenter' => 'Reward Center', 'account.bettingRecord' => 'Betting Record', 'account.profitAndLoss' => 'Profit & Loss', 'account.depositRecord' => 'Deposit Record', 'account.withdrawalRecord' => 'Withdrawal Record', 'account.accountRecord' => 'Account Record', 'account.securityCenter' => 'Security Center', 'account.inviteFriends' => 'Invite Friends', 'account.manualRebate' => 'Manual Rebate', 'account.internalMessage' => 'Internal Message', 'account.suggestion' => 'Suggestion', 'account.downloadApp' => 'Download App', 'account.customerService' => 'Customer Service', 'account.helpCenter' => 'Help Center', 'account.logout' => 'Log Out', // ── Deposit page ───────────────────────────────────────────────────── 'deposit.deposit' => 'Deposit', 'deposit.depositAmount' => 'Deposit Amount', 'deposit.selectBank' => 'Select Bank', 'deposit.transactionId' => 'Transaction ID', 'deposit.submit' => 'Submit', 'deposit.processing' => 'Processing...', // ── Withdrawal page ────────────────────────────────────────────────── 'withdrawal.withdrawal' => 'Withdrawal', 'withdrawal.withdrawalAmount' => 'Withdrawal Amount', 'withdrawal.selectBank' => 'Select Bank', 'withdrawal.submit' => 'Submit', 'withdrawal.processing' => 'Processing...', // ── Invite Friends ─────────────────────────────────────────────────── 'invite.referAndEarn' => 'Refer & Earn', 'invite.shareWithFriends' => 'Share with Friends', 'invite.copy' => 'Copy', 'invite.copiedSuccessfully'=> 'Copied successfully!', 'invite.todaysIncome' => "Today's Income", 'invite.yesterdaysIncome' => "Yesterday's Income", 'invite.registers' => 'Registers', 'invite.validReferral' => 'Valid Referral', // ── Reward / Bonus ─────────────────────────────────────────────────── 'reward.bonus' => 'Bonus', 'reward.rescueFund' => 'Rescue Fund', 'reward.inviteFriends' => 'Invite Friends', 'reward.benefits' => 'Benefits', 'bonus.dailyBonus' => 'Daily Bonus', 'bonus.redPackage' => 'Red Package', 'bonus.claim' => 'Claim', 'bonus.close' => 'Close', 'bonus.congratulations' => 'Congratulations', // ── Records ────────────────────────────────────────────────────────── 'record.bettingRecord' => 'Betting Record', 'record.profitLoss' => 'Profit & Loss', 'record.depositHistory' => 'Deposit History', 'record.withdrawHistory' => 'Withdrawal History', 'record.accountRecord' => 'Account Record', 'record.loading' => 'Loading...', 'record.noRecords' => 'No records found', // ── Share page ─────────────────────────────────────────────────────── 'share.shareAndWin' => 'Share & Win', 'share.inviteCode' => 'Invite Code', 'share.copy' => 'Copy', 'share.shareNow' => 'Share Now', // ── Misc / Common ──────────────────────────────────────────────────── 'common.loading' => 'Loading...', 'common.submit' => 'Submit', 'common.cancel' => 'Cancel', 'common.close' => 'Close', 'common.save' => 'Save', 'common.back' => 'Back', 'common.next' => 'Next', 'common.yes' => 'Yes', 'common.no' => 'No', 'common.ok' => 'OK', 'common.error' => 'Error', 'common.success' => 'Success', 'common.amount' => 'Amount', 'common.balance' => 'Balance', 'common.copy' => 'Copy', 'common.paste' => 'Paste', 'common.search' => 'Search', ]; $_translations_bn = [ // ── Sidebar ────────────────────────────────────────────────────────── 'sidebar.promotion' => 'প্রচার', 'sidebar.withdraw' => 'উত্তোলন', 'sidebar.inviteFriends' => 'বন্ধুদের আমন্ত্রণ জানান', 'sidebar.rewardCenter' => 'পুরস্কার কেন্দ্র', 'sidebar.gameCenter' => 'খেলার কেন্দ্র', 'sidebar.slots' => 'স্লট', 'sidebar.liveCasino' => 'লাইভ ক্যাসিনো', 'sidebar.fish' => 'মাছ', 'sidebar.sports' => 'খেলাধুলা', 'sidebar.cricket' => 'ক্রিকেট', 'sidebar.tennis' => 'টেনিস', 'sidebar.football' => 'ফুটবল', 'sidebar.other' => 'অন্যান্য', 'sidebar.eGame' => 'এগেম', 'sidebar.poker' => 'পকার', 'sidebar.all' => 'সব', 'sidebar.slot' => 'স্লট', 'sidebar.account' => 'অ্যাকাউন্ট', 'sidebar.cashback' => 'ক্যাশব্যাক', 'sidebar.vipCenter' => 'ভিআইপি কেন্দ্র', 'sidebar.bettingRecord' => 'বেটিং রেকর্ড', 'sidebar.accountRecord' => 'অ্যাকাউন্ট রেকর্ড', 'sidebar.securityCenter' => 'নিরাপত্তা কেন্দ্র', 'sidebar.depositRecord' => 'জমা রেকর্ড', 'sidebar.profitLoss' => 'লাভ ও ক্ষতি', 'sidebar.mail' => 'মেইল', 'sidebar.downloadApp' => 'অ্যাপ ডাউনলোড করুন', 'sidebar.customerService' => 'গ্রাহক পরিষেবা', 'sidebar.helpCenter' => 'সাহায্য কেন্দ্র', 'sidebar.language' => 'ভাষা', 'sidebar.turnover' => 'টার্নওভার', 'sidebar.openBets' => 'ওপেন বেট', 'sidebar.depositHistory' => 'জমা ইতিহাস', 'sidebar.logOut' => 'লগ আউট', 'sidebar.shareEarn' => 'শেয়ার ও উপার্জন', 'sidebar.deposit' => 'জমা', 'sidebar.sharesAndEarnings'=> 'শেয়ার ও উপার্জন', 'sidebar.playCenter' => 'প্লে সেন্টার', 'sidebar.inviteFriendsBtn' => 'বন্ধুদের আমন্ত্রণ', 'sidebar.downloadTheApp' => 'অ্যাপ ডাউনলোড করুন', 'sidebar.customerServiceBtn'=> 'গ্রাহক পরিষেবা', 'sidebar.submissionHistory'=> 'জমা ইতিহাস', 'sidebar.lifting' => 'উত্তোলন', 'sidebar.openBet' => 'ওপেন বেট', // ── Footer ─────────────────────────────────────────────────────────── 'footer.home' => 'হোম', 'footer.promotion' => 'প্রচার', 'footer.share' => 'শেয়ার', 'footer.reward' => 'পুরস্কার', 'footer.account' => 'অ্যাকাউন্ট', // ── Header / Navigation ────────────────────────────────────────────── 'header.login' => 'লগ ইন', 'header.register' => 'নিবন্ধন', 'header.getBonus' => 'বোনাস পান', // ── Login / Register page ──────────────────────────────────────────── 'login.logIn' => 'লগ ইন', 'login.register' => 'নিবন্ধন', 'login.username' => 'ব্যবহারকারীর নাম', 'login.mobile' => 'মোবাইল নম্বর', 'login.password' => 'পাসওয়ার্ড', 'login.pin' => 'পিন', 'login.confirmPassword' => 'পাসওয়ার্ড নিশ্চিত করুন', 'login.referralCode' => 'রেফারেল কোড', 'login.optional' => '(ঐচ্ছিক)', 'login.remember' => 'মনে রাখুন', 'login.forgotPassword' => 'পাসওয়ার্ড ভুলে গেছেন?', 'login.loggingIn' => 'লগ ইন হচ্ছে...', 'login.registering' => 'নিবন্ধন হচ্ছে...', 'login.noAccount' => 'এখনও কোন অ্যাকাউন্ট নেই?', 'login.haveAccount' => 'ইতিমধ্যে একটি অ্যাকাউন্ট আছে?', 'login.passwordNotMatch' => 'পাসওয়ার্ডগুলো মেলে না', 'login.getStarted' => 'শুরু করুন', 'login.welcome' => 'স্বাগতম', 'login.signUpNow' => 'এখনই সাইন আপ করুন', // ── Index page (landing) ───────────────────────────────────────────── 'index.welcomeTitle' => 'MELBETE তে স্বাগতম', 'index.welcomeSubtitle' => 'সেরা অনলাইন গেমিং ও বেটিং প্ল্যাটফর্ম', 'index.loginBtn' => 'লগ ইন', 'index.registerBtn' => 'নিবন্ধন', 'index.getFreeBonus' => 'বিনামূল্যে বোনাস নিন', 'index.playNow' => 'এখনই খেলুন', 'index.joinNow' => 'এখনই যোগ দিন', // ── Dashboard ──────────────────────────────────────────────────────── 'dashboard.total' => 'মোট', 'dashboard.seeAll' => 'সব দেখুন', 'dashboard.searchGames' => 'গেম খুঁজুন...', 'dashboard.deposit' => 'জমা', 'dashboard.withdrawal' => 'উত্তোলন', 'dashboard.share' => 'শেয়ার', 'dashboard.noFavorites' => 'এখনও কোনো প্রিয় গেম নেই', 'dashboard.addFavorites' => 'যেকোনো গেমে ♡ চাপুন যোগ করতে।', 'dashboard.logOut' => 'লগ আউট', // ── Account page ───────────────────────────────────────────────────── 'account.myAccount' => 'আমার অ্যাকাউন্ট', 'account.nickname' => 'ছদ্মনাম', 'account.deposit' => 'জমা', 'account.withdrawal' => 'উত্তোলন', 'account.myCards' => 'আমার কার্ডগুলো', 'account.memberCenter' => 'সদস্য কেন্দ্র', 'account.rewardCenter' => 'পুরস্কার কেন্দ্র', 'account.bettingRecord' => 'বেটিং রেকর্ড', 'account.profitAndLoss' => 'লাভ ও ক্ষতি', 'account.depositRecord' => 'জমা রেকর্ড', 'account.withdrawalRecord' => 'উত্তোলন রেকর্ড', 'account.accountRecord' => 'অ্যাকাউন্ট রেকর্ড', 'account.securityCenter' => 'নিরাপত্তা কেন্দ্র', 'account.inviteFriends' => 'বন্ধুদের আমন্ত্রণ জানান', 'account.manualRebate' => 'ম্যানুয়াল ছাড়', 'account.internalMessage' => 'অভ্যন্তরীণ বার্তা', 'account.suggestion' => 'পরামর্শ', 'account.downloadApp' => 'অ্যাপ ডাউনলোড করুন', 'account.customerService' => 'গ্রাহক পরিষেবা', 'account.helpCenter' => 'সাহায্য কেন্দ্র', 'account.logout' => 'লগ আউট', // ── Deposit page ───────────────────────────────────────────────────── 'deposit.deposit' => 'জমা', 'deposit.depositAmount' => 'জমার পরিমাণ', 'deposit.selectBank' => 'ব্যাংক নির্বাচন করুন', 'deposit.transactionId' => 'লেনদেন আইডি', 'deposit.submit' => 'জমা দিন', 'deposit.processing' => 'প্রক্রিয়াধীন...', // ── Withdrawal page ────────────────────────────────────────────────── 'withdrawal.withdrawal' => 'উত্তোলন', 'withdrawal.withdrawalAmount' => 'উত্তোলনের পরিমাণ', 'withdrawal.selectBank' => 'ব্যাংক নির্বাচন করুন', 'withdrawal.submit' => 'জমা দিন', 'withdrawal.processing' => 'প্রক্রিয়াধীন...', // ── Invite Friends ─────────────────────────────────────────────────── 'invite.referAndEarn' => 'রেফার করুন এবং উপার্জন করুন', 'invite.shareWithFriends' => 'বন্ধুদের সাথে শেয়ার করুন', 'invite.copy' => 'কপি', 'invite.copiedSuccessfully'=> 'সফলভাবে কপি করা হয়েছে!', 'invite.todaysIncome' => 'আজকের আয়', 'invite.yesterdaysIncome' => 'গত কালের আয়', 'invite.registers' => 'রেজিস্টার', 'invite.validReferral' => 'বৈধ রেফারেল', // ── Reward / Bonus ─────────────────────────────────────────────────── 'reward.bonus' => 'বোনাস', 'reward.rescueFund' => 'রেসকিউ ফান্ড', 'reward.inviteFriends' => 'বন্ধুদের আমন্ত্রণ জানান', 'reward.benefits' => 'উপকারিতা', 'bonus.dailyBonus' => 'দৈনিক বোনাস', 'bonus.redPackage' => 'লাল প্যাকেজ', 'bonus.claim' => 'দাবি করুন', 'bonus.close' => 'বন্ধ', 'bonus.congratulations' => 'অভিনন্দন', // ── Records ────────────────────────────────────────────────────────── 'record.bettingRecord' => 'বেটিং রেকর্ড', 'record.profitLoss' => 'লাভ ও ক্ষতি', 'record.depositHistory' => 'জমা ইতিহাস', 'record.withdrawHistory' => 'উত্তোলন ইতিহাস', 'record.accountRecord' => 'অ্যাকাউন্ট রেকর্ড', 'record.loading' => 'লোড হচ্ছে...', 'record.noRecords' => 'কোন রেকর্ড পাওয়া যায়নি', // ── Share page ─────────────────────────────────────────────────────── 'share.shareAndWin' => 'শেয়ার করুন এবং জিতুন', 'share.inviteCode' => 'আমন্ত্রণ কোড', 'share.copy' => 'কপি', 'share.shareNow' => 'এখনই শেয়ার করুন', // ── Misc / Common ──────────────────────────────────────────────────── 'common.loading' => 'লোড হচ্ছে...', 'common.submit' => 'জমা দিন', 'common.cancel' => 'বাতিল', 'common.close' => 'বন্ধ', 'common.save' => 'সংরক্ষণ', 'common.back' => 'পিছনে', 'common.next' => 'পরবর্তী', 'common.yes' => 'হ্যাঁ', 'common.no' => 'না', 'common.ok' => 'ঠিক আছে', 'common.error' => 'ত্রুটি', 'common.success' => 'সফল', 'common.amount' => 'পরিমাণ', 'common.balance' => 'ব্যালেন্স', 'common.copy' => 'কপি', 'common.paste' => 'পেস্ট', 'common.search' => 'খুঁজুন', ]; // Store globally $GLOBALS['_lang_table'] = ($GLOBALS['_site_lang'] === 'bn') ? $_translations_bn : $_translations_en; // --------------------------------------------------------------------------- // 3. Translation function // --------------------------------------------------------------------------- if (!function_exists('__')) { /** * Translate a key to the currently active language. * Returns the English fallback if the key is not found in either table. * * @param string $key Dot-notation key, e.g. 'sidebar.promotion' * @param string $default Fallback string if key not found * @return string */ function __(string $key, string $default = ''): string { $table = $GLOBALS['_lang_table'] ?? []; if (isset($table[$key])) { return $table[$key]; } // Try English fallback global $_translations_en; if (isset($_translations_en[$key])) { return $_translations_en[$key]; } return $default !== '' ? $default : $key; } } // --------------------------------------------------------------------------- // 4. Helper: is current language Bangla? // --------------------------------------------------------------------------- if (!function_exists('is_bn')) { function is_bn(): bool { return ($GLOBALS['_site_lang'] ?? 'en') === 'bn'; } }
💾 Save