DEV Community

Cover image for Automatic Language Support: Add a Modern TR/EN Toggle to Any PHP/HTML Site (Fast)
Mehmet Bulat
Mehmet Bulat

Posted on • Originally published at github.com

Automatic Language Support: Add a Modern TR/EN Toggle to Any PHP/HTML Site (Fast)

Why I built this

Internationalization is one of those "I'll do it later" items... until your site suddenly needs Turkish + English yesterday.

The usual options are either:

  • Too heavy for a small project (framework-level i18n plumbing, lots of refactors), or
  • Too manual (copy/paste strings into files forever, pray nothing breaks).

So I built a pragmatic helper: Automatic Language Support - a script that can add multi-language support to existing PHP or HTML projects with minimal fuss.

It is designed for the "ship it" moments:

  • landing pages
  • small product sites
  • internal tools
  • client projects where "just make it bilingual" lands in your inbox at 18:59

What it does (in plain terms)

Automatic Language Support:

  • processes your project text automatically,
  • stores strings in JSON,
  • and adds a modern, responsive language switcher to your pages.

In short: run it once, let it do the setup, then you control translations via JSON.

Key features

  • Automatic language detection and switching
  • JSON-based string storage (easy to manage, easy to diff)
  • Stylish toggle button (modern and responsive)
  • Seamless integration for existing PHP/HTML projects

Quick start

1) Clone

git clone https://github.com/mebularts/Automatic-Language-Support.git
Enter fullscreen mode Exit fullscreen mode

2) Run the script

Run the script and select your project folder. The script will process your files and add what is needed.

3) Customize translations via JSON

After the run:

  • a language toggle button is added to the footer,
  • text is translated based on stored JSON files,
  • and you can edit en.json / tr.json in the assets folder to customize.

Tip: Keep your JSON keys stable, and treat the JSON as a "source of truth" for your UI copy.

Demo (UI idea)

Here is a small CodePen that demonstrates the toggle UI concept:

Repository

If you want to try it immediately:

GitHub logo mebularts / Automatic-Language-Support

Thanks to this code, you can add multiple language support to any site you want with a single click. It does the installation automatically when you run the code | @mebularts

License Developer Follow me Boyut Görüntülenme

InstagramTwitterTelegramCodepen

ForTheBadge built-with-love forthebadge

EN | Automatic Language Support

Automatic Language Support is a versatile script designed to add automatic language support to your PHP or HTML projects. It automatically processes your text, stores it in JSON files, and adds a modern, stylish language switcher to your web pages.

Features

  • Automatic Language Detection: Easily detects and switches between languages.
  • Customizable JSON Files: Stores text in JSON format for easy management.
  • Stylish Toggle Button: Includes a modern and responsive language toggle button.
  • Seamless Integration: Integrates smoothly with your existing PHP or HTML projects.

Installation

  1. Clone the repository:
    git clone https://github.com/mebularts/Automatic-Language-Support.git
    Enter fullscreen mode Exit fullscreen mode
  2. Run the script and select your project folder.
  3. The script will automatically process your files and add the necessary language support.

Usage

  • Once the script has run, your project will have a language toggle button added to the footer of your web pages.
  • Text will be automatically translated based on the stored…

When this tool is a good fit

This tool shines when:

  • you want bilingual support quickly
  • your site is already built (PHP/HTML) and you do not want a full refactor
  • you prefer simple JSON over complex localization pipelines
  • you want a clean toggle that does not look like it time-traveled from 2009

Notes and expectations (the honest part)

No auto i18n tool can magically understand your brand voice, industry terms, or context the way humans do.

This is best used as:

  • a fast bootstrapper,
  • a structure generator,
  • and a workflow accelerator.

You still get full control via the JSON files (en.json, tr.json) once the base is in place.

Roadmap ideas (if people want it)

If there is interest, I would love to iterate on:

  • more language packs (beyond EN/TR)
  • better string grouping / namespaces
  • optional per-page toggles
  • finer control over where the switcher is injected

If you try it and have feedback, open an issue - real-world pain points are the best roadmap.

License

This repository is published under GPL-3.0.


TL;DR

Automatic Language Support adds bilingual support to PHP/HTML projects by processing your text, saving it into JSON, and injecting a modern language switcher - quickly.

If it can be automated, I probably already tried.

Top comments (0)