Compare commits

..

20 Commits

Author SHA1 Message Date
2949c48ed9 Merge branch 'master' into resizeSvg 2025-04-12 10:57:55 -05:00
6aedbbc942 Styling changes mostly done 2025-04-12 11:55:40 -04:00
977cd1aa62 Add parentheses around arithmetic operation 2025-04-11 10:17:56 -04:00
81fe778212 Works even better now 2025-04-11 10:12:57 -04:00
bf8825294b Mostly working 2025-04-10 11:37:55 -04:00
6e9e11c41c Made some progress 2025-04-09 10:34:52 -04:00
66d88c133b Started working on resizing SVG 2025-04-08 23:53:13 -04:00
f62697d03a Kept changes from production use 2025-04-06 11:24:56 -05:00
ad254d2760 Added separate styling for mobile 2025-04-06 12:01:20 -04:00
49b4820c2d Removed Santali language (since it doesnt' have transliteration support) 2025-04-06 12:01:04 -04:00
3d0c20ae48 Added signal handling 2025-03-29 11:59:36 -05:00
3d06971e77 Remove testing code; use minified map JSON; hide spinner after map has loaded 2025-03-28 14:41:51 -05:00
50a476edad Change function name; add code to hide, show and change text for the 'fetching translations/romanizations' text 2025-03-28 14:41:02 -05:00
2814f80fc8 Update translations DB 2025-03-28 14:40:39 -05:00
74f3cb9740 Added minified version of JSON 2025-03-28 14:40:26 -05:00
2f7cdd2ea7 Add loading spinner while map loads; fade in map and fade out spinner; load HTMX locally; show text while translations and romanizations are being fetched 2025-03-28 14:40:10 -05:00
1fbe5a1abf Download HTMX locally 2025-03-28 13:46:31 -05:00
c15bd02c17 Added pointer-events: none for state boundaries, updated translations 2025-03-28 10:02:49 -05:00
bf453f9934 Added romanization server code 2025-03-27 08:47:36 -04:00
a4a2451edd Updated translations DB 2025-03-25 11:50:21 -04:00
11 changed files with 482 additions and 1052 deletions

View File

@@ -7,6 +7,9 @@ import (
"fmt"
"log"
"net/http"
"os"
"os/signal"
"syscall"
"github.com/jmoiron/sqlx"
_ "github.com/mattn/go-sqlite3"
@@ -33,7 +36,6 @@ type translationStruct struct {
As string `db:"assamese" json:"as"`
Pa string `db:"punjabi" json:"pa"`
Mai string `db:"maithili" json:"mai"`
Sat string `db:"santali" json:"sat"`
Ne string `db:"nepali" json:"ne"`
Gom string `db:"konkani" json:"gom"`
Tcy string `db:"tulu" json:"tcy"`
@@ -59,7 +61,6 @@ var lang_codes []string = []string{
"as", // Assamese
"pa", // Punjabi
"mai", // Maithili
"sat", // Santali
"ne", // Nepali
"gom", // Konkani
"tcy", // Tulu
@@ -72,6 +73,12 @@ var lang_codes []string = []string{
var db *sqlx.DB
func cleanup() {
db.Close()
log.Printf("Shutting down...\n")
return
}
/*
Returns the cached translation from the database, for the given english text. The first parameter
@@ -97,7 +104,7 @@ func getCachedTranslation(data string) (bool, translationStruct) {
}
func addToDatabase(translation translationStruct) {
_, err := db.NamedExec(`INSERT INTO translations VALUES (:english, :hindi, :bengali, :marathi, :tamil, :telugu, :kannada, :malayalam, :oriya, :gujarati, :urdu, :mizo, :assamese, :punjabi, :maithili, :santali, :nepali, :konkani, :tulu, :bhojpuri, :dogri, :manipuri, :sindhi, :awadhi)`, &translation)
_, err := db.NamedExec(`INSERT INTO translations VALUES (:english, :hindi, :bengali, :marathi, :tamil, :telugu, :kannada, :malayalam, :oriya, :gujarati, :urdu, :mizo, :assamese, :punjabi, :maithili, :nepali, :konkani, :tulu, :bhojpuri, :dogri, :manipuri, :sindhi, :awadhi)`, &translation)
if err != nil {
panic(err)
}
@@ -168,13 +175,28 @@ func handler(w http.ResponseWriter, r *http.Request) {
}
func main() {
fmt.Printf("Starting server...")
log.Printf("Starting server...")
var err error
db, err = sqlx.Connect("sqlite3", "../translations.db")
if err != nil {
panic(err)
}
defer db.Close()
// Catch signal
sigs := make(chan os.Signal, 1)
signal.Notify(sigs)
go func() {
for sig := range sigs {
log.Printf("Received signal: %s", sig)
switch sig {
case syscall.SIGURG:
log.Printf("Ignoring sigurg")
case syscall.SIGTERM, syscall.SIGINT:
cleanup()
os.Exit(1)
}
}
}()
http.HandleFunc("/", handler)
log.Fatal(http.ListenAndServe(":9090", nil))

1
htmx.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@@ -10,7 +10,7 @@
<title>Indian Translate</title>
<script src="https://d3js.org/d3.v7.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@turf/turf@7/turf.min.js" charset="utf-8"></script>
<script src="https://unpkg.com/htmx.org@2.0.4" integrity="sha384-HGfztofotfshcF7+8n44JQL2oJmowVChPTg48S+jvZoztPfvwD79OC/LTtG6dMp+" crossorigin="anonymous"></script>
<script src="./htmx.min.js"></script>
<style>
body {
background-color: #f4f4f4;
@@ -19,12 +19,21 @@
display: flex;
align-items: flex-start;
justify-content: space-evenly;
gap: 2em 2em;
}
svg {
border: 1px solid;
padding: 2em;
visibility: hidden;
opacity: 0;
transition: opacity 1s, visibility 2s;
}
svg.show {
visibility: visible;
opacity: 1;
}
h1 {
margin-block: 0.67em;
font-size: 2em;
@@ -34,6 +43,7 @@
stroke: black;
fill: none;
stroke-width: 0.5;
pointer-events: none;
}
.language {
stroke: red;
@@ -47,7 +57,7 @@
.translationText, .romanizationText {
visibility: hidden;
font-family: "Noto Sans";
font-size:1.25em;
font-size:1.2em;
}
.romanizationText {
@@ -57,7 +67,7 @@
.languageText {
pointer-events: none;
font-weight: bold;
font-size: 1.15em;
font-size: 1em;
font-family: sans-serif;
visibility: hidden;
}
@@ -65,11 +75,6 @@
visibility: visible;
}
.testClass:hover {
fill: red;
cursor: default;
}
.district {
stroke: white;
stroke-width: 0.25;
@@ -77,6 +82,7 @@
fill: none;
pointer-events: none;
}
.language:hover {
stroke-width: 2;
}
@@ -106,21 +112,110 @@
fill-opacity: 1;
transition: fill-opacity 0.3s;
}
/* Position map load spinner in the middle of the SVG */
#svgContainer {
position: relative;
display: inline-block;
flex-grow: 1;
max-width: 100%;
}
#svgContainer .mapLoadSpinner {
position: absolute;
top: 40%;
left: 40%;
}
/* Credit to https://lukehaas.me/projects/css-loaders/ */
.mapLoadSpinner,
.mapLoadSpinner:after {
border-radius: 50%;
width: 10em;
height: 10em;
transition: opacity 1s, visibility 2s;
}
.mapLoadSpinner.hide {
opacity: 0;
visibility: hidden;
}
.mapLoadSpinner {
margin: 60px auto;
font-size: 10px;
position: relative;
text-indent: -9999em;
border-top: 1.1em solid rgba(255,158,83, 0.2);
border-right: 1.1em solid rgba(255,158,83, 0.2);
border-bottom: 1.1em solid rgba(255,158,83, 0.2);
border-left: 1.1em solid #ff9e53;
-webkit-transform: translateZ(0);
-ms-transform: translateZ(0);
transform: translateZ(0);
-webkit-animation: load8 1.1s infinite linear;
animation: load8 1.1s infinite linear;
}
@-webkit-keyframes load8 {
0% {
-webkit-transform: rotate(0deg);
transform: rotate(0deg);
}
100% {
-webkit-transform: rotate(360deg);
transform: rotate(360deg);
}
}
@keyframes load8 {
0% {
-webkit-transform: rotate(0deg);
transform: rotate(0deg);
}
100% {
-webkit-transform: rotate(360deg);
transform: rotate(360deg);
}
}
#fetchingText {
visibility: hidden;
}
@media only screen and (max-width: 768px) {
main {
flex-direction: column;
align-items: stretch;
}
.district {
stroke-width: 0.1;
}
.translationText, .romanizationText {
font-size: 0.7em;
}
.languageText {
font-size: 0.6em;
}
}
</style>
</head>
<body>
<main>
<section id="textStuff">
<h1>Indian Translate</h1>
<form hx-get="/submit" hx-swap=none hx-indicator="#loading-screen" hx-on::before-request="hideText(event.detail.xhr.response)" hx-on::after-request="updateTranslations(event.detail.xhr.response)" class="translateForm" method="get">
<form hx-get="/submit" hx-swap=none hx-indicator="#loading-screen" hx-on::before-request="hideTranslationsAndShowText(event.detail.xhr.response)" hx-on::after-request="updateTranslations(event.detail.xhr.response)" class="translateForm" method="get">
<label for="query">Enter text to translate:</label>
<input type="text" name="query" id="query" required/>
<input type="submit" value="Translate"/>
</form>
<progress id="loading-screen" class="loading-indicator"></progress>
<h3 id="fetchingText">Fetching translations...</h3>
<noscript>
<h2>This website requires javascript to work.</h2>
</noscript>
</section>
<svg id = "indiaMap" width="1300" height="1300"></svg>
<section id="svgContainer">
<div id="mapLoadSpinner" class="mapLoadSpinner"></div>
</section>
</main>
<script type="text/javascript" src="index.js"></script>

105
index.js
View File

@@ -1,5 +1,3 @@
const svg = d3.select("svg")
const defaultColor = "#555555"
const languages = {
@@ -23,7 +21,6 @@ const languages = {
urdu: {name: "Urdu", color: "#3fa179", code: "ur", districts: []},
tulu: {name: "Tulu", color: "#dedc52", code: "tcy", districts: []},
maithali: {name: "Maithali", color: "#4472a6", code: "mai", districts: []},
santali: {name: "Santali", color: "#96bf60", code: "sat", districts: []},
sindhi: {name: "Sindhi", color: "#e89931", code: "sd", districts: []},
awadhi: {name: "Awadhi", color: "#847fb5", code: "awa", districts: []},
};
@@ -117,17 +114,6 @@ const district2lang = { // Should override state colors
"Kutch": languages["sindhi"],
"Godda": languages["santali"],
"Deoghar": languages["santali"],
"Dumka": languages["santali"],
"Jamtara": languages["santali"],
"Sahibganj": languages["santali"],
"Pakur": languages["santali"],
"East Singhbhum": languages["santali"],
"Jhargram": languages["santali"],
"Bankura": languages["santali"],
"Purulia": languages["santali"],
"Kanpur": languages["awadhi"],
"Lakhimpur Kheri": languages["awadhi"],
"Sitapur": languages["awadhi"],
@@ -141,6 +127,33 @@ const district2lang = { // Should override state colors
"Bahraich": languages["awadhi"],
}
function responsivefy(svg) {
// get container + svg aspect ratio
var container = d3.select(svg.node().parentNode),
width = parseInt(svg.style("width")),
height = parseInt(svg.style("height")),
aspect = width / height;
// add viewBox and preserveAspectRatio properties,
// and call resize so that svg resizes on inital page load
svg.attr("viewBox", "0 0 " + width + " " + height)
.attr("perserveAspectRatio", "xMinYMid")
.call(resize);
// to register multiple listeners for same event type,
// you need to add namespace, i.e., 'click.foo'
// necessary if you call invoke this function for multiple svgs
// api docs: https://github.com/mbostock/d3/wiki/Selections#on
d3.select(window).on("resize." + container.attr("id"), resize);
// get width of container and resize svg to fit it
function resize() {
var targetWidth = Math.floor(container.node().getBoundingClientRect().width);
svg.attr("width", targetWidth);
svg.attr("height", Math.round(targetWidth / aspect));
}
}
// Functions for calculating and dealing with language boundaries
function reverseCoordArrays(coords) {
if (!Array.isArray(coords)) {
@@ -197,12 +210,40 @@ function stateOrDistrictOrLanguage(d) {
}
}
// const mapWidth = document.getElementById("indiaMap").getAttribute("width")
// const mapHeight = document.getElementById("indiaMap").getAttribute("height")
const mapWidth = /*window.innerWidth - */document.querySelector("#svgContainer").offsetWidth * 0.85;
// const mapHeight = document.querySelector("#svgContainer").offsetHeight;
const mapHeight = (window.innerHeight - document.querySelector("#svgContainer").getBoundingClientRect().top);
const svg = d3.select("#svgContainer")
.append('svg')
.attr('width', mapWidth.toString())
.attr('height', (mapHeight).toString())
// .attr('viewbox', '0 0 ' + mapWidth.toString() + ' ' + mapHeight.toString())
// .attr('preserveAspectRatio', "xMidYMin")
.attr('id', 'indiaMap')
// .call(responsivefy);
function drawMap(world) {
const mapWidth = document.getElementById("indiaMap").getAttribute("width")
const mapHeight = document.getElementById("indiaMap").getAttribute("height")
const projection = d3.geoMercator().fitSize([mapWidth, mapHeight], world)
const path = d3.geoPath().projection(projection);
requestAnimationFrame(() => {
const newSvg = d3.select('svg');
const bbox = newSvg.node().getBBox();
const originalWidth = +newSvg.attr("width");
newSvg
// .attr("viewBox", `${bbox.x} ${bbox.y} ${bbox.width} ${bbox.height}`)
.attr("viewBox", `0 ${bbox.y} ${originalWidth} ${bbox.height}`)
// .attr("width", mapHeight.toString())
.attr("height", bbox.height)
// .style("display", "block")
// .style("max-height", "100%"); // optional: keep it scalable in a flexbox
});
const states = svg.selectAll("g")
.data(world.features)
.enter()
@@ -223,6 +264,10 @@ function drawMap(world) {
districtLang.districts.push(d)
}
}
// Hide map load spinner after map has loaded
document.getElementById("mapLoadSpinner").classList.add("hide");
document.querySelector("svg").classList.add("show");
})
.append("title") // Tooltip
.text(d => d.properties.district);
@@ -242,6 +287,9 @@ function drawMap(world) {
}
if (d.properties.lang_name == "Konkani") {
rtv -= 15;
}
if (d.properties.lang_name == "Bengali") {
rtv -= 15;
}
return rtv
}
@@ -264,6 +312,9 @@ function drawMap(world) {
if (d.properties.lang_name == "Nepali") {
rtv -= 10;
}
if (d.properties.lang_name == "Bengali") {
rtv += 25;
}
return rtv
}
@@ -339,21 +390,21 @@ function drawMap(world) {
} else {
d3.select(this).remove() // Only add this attribute if the element is a language
}
});
})
let allLangs = []
const coordinates = [77.69916967457782,23.389970772934166];
const [xCoord, yCoord] = projection(coordinates);
svg.append("text")
.attr("x", xCoord)
.attr("y", yCoord)
.attr("class", "testClass")
.attr("text-anchor", "middle")
.attr("font-size", "12px")
.attr("fill", "black")
.text("Hello, Map!");
// svg.append("text")
// .attr("x", xCoord)
// .attr("y", yCoord)
// .attr("class", "testClass")
// .attr("text-anchor", "middle")
// .attr("font-size", "12px")
// .attr("fill", "black")
// .text("Hello, Map!");
// for (const [langId,lang] of Object.entries(languages)) {
// let geojson = {
// "type": "FeatureCollection",
@@ -377,4 +428,4 @@ function drawMap(world) {
}
d3.json("india_with_districts_with_languages.json").then(drawMap)
d3.json("india_with_districts_with_languages_min.json").then(drawMap)

View File

@@ -6342,20 +6342,76 @@
22.9967235114937
],
[
86.18778547532466,
22.94723235336187
86.50126897280225,
22.993974002708597
],
[
86.19848978987267,
22.818005440462084
86.43551389772158,
22.926611037473606
],
[
86.15873090726576,
22.75201722961964
86.41869283200327,
22.790510352611065
],
[
86.14955578051031,
22.63103884307516
86.55937810892004,
22.713524106628213
],
[
86.64195424971902,
22.65715917653363
],
[
86.65877531543732,
22.576048667373126
],
[
86.76581846091747,
22.576048667373126
],
[
86.80098978014666,
22.488064386249867
],
[
86.7642892731249,
22.426200438585077
],
[
86.84533622613131,
22.400080105126612
],
[
86.83310272379072,
22.32584336792886
],
[
86.72758876610314,
22.21586301652479
],
[
86.55479054554232,
22.298348280077846
],
[
86.49668140942453,
22.346464683817125
],
[
86.42939714655128,
22.316220087181005
],
[
86.3590545080929,
22.349214192602226
],
[
86.28259511846423,
22.44819650886589
],
[
86.11897202465885,
22.486689631857317
],
[
86.06697963971135,
@@ -9635,6 +9691,54 @@
"coordinates": [
[
[
[
85.81925121731442,
23.268924881218776
],
[
85.8834771046025,
23.35003539037928
],
[
85.85901009992133,
23.42977114514723
],
[
85.88500629239508,
23.48338656645672
],
[
86.03945425944502,
23.498508864774777
],
[
86.08227151763708,
23.565871830009772
],
[
86.15873090726576,
23.558998058047017
],
[
86.17708116077664,
23.469639022531208
],
[
86.31012049873054,
23.411899338044073
],
[
86.36517125926319,
23.531502970195998
],
[
86.48597709487652,
23.63598430402987
],
[
86.7122968881774,
23.69922300608721
],
[
86.80098978014666,
23.69922300608721
@@ -10380,100 +10484,92 @@
21.964282962687975
],
[
87.13741109451287,
22.12650398100898
87.10835652645397,
21.924415085304
],
[
87.1817575404975,
22.191117437458875
87.10071058749111,
21.86392589203176
],
[
87.2046953573861,
22.303847297648048
87.00131338097381,
21.913417050163595
],
[
87.16187809919404,
22.424825684192527
87.02883876124014,
22.038519699885725
],
[
87.08236033398022,
22.471567333539255
86.96461287395205,
22.085261349232454
],
[
87.09918139969852,
22.6942775451325
86.83769028716844,
22.097634138765414
],
[
87.07624358280992,
22.725896896161174
86.72758876610314,
22.21586301652479
],
[
87.06401008046933,
22.850999545883305
86.83310272379072,
22.32584336792886
],
[
87.27045043246677,
22.903240212800238
86.84533622613131,
22.400080105126612
],
[
87.35761413664346,
22.95410612532462
],
[
87.45701134316076,
22.912863493548095
],
[
87.52276641824142,
22.927985791866156
],
[
87.63133875151414,
22.899115949622587
],
[
87.64204306606216,
22.98160121317564
],
[
87.71238570452054,
23.01047105541921
],
[
87.76437808946804,
23.0750845118691
],
[
87.64510144164731,
23.19606289841358
],
[
87.55640854967804,
23.312917021780407
],
[
87.44936540419789,
23.402276057296216
],
[
87.27809637142964,
23.499883619167328
],
[
87.20928292076383,
23.557623303654466
],
[
87.01507607110698,
23.631860040852214
],
[
86.90191617445653,
23.63873381281497
86.7642892731249,
22.426200438585077
],
[
86.80098978014666,
23.69922300608721
22.488064386249867
],
[
86.76581846091747,
22.576048667373126
],
[
86.65877531543732,
22.576048667373126
],
[
86.64195424971902,
22.65715917653363
],
[
86.55937810892004,
22.713524106628213
],
[
86.41869283200327,
22.790510352611065
],
[
86.43551389772158,
22.926611037473606
],
[
86.50126897280225,
22.993974002708597
],
[
86.24130704806473,
22.9967235114937
],
[
86.04404182282273,
23.145196985889196
],
[
85.88500629239508,
23.16719305617001
],
[
85.81925121731442,
23.268924881218776
]
]
],
@@ -14635,68 +14731,116 @@
25.258194487239926
],
[
87.69250626321708,
25.31180990854941
87.77814077960122,
25.24994596088462
],
[
87.55182098630031,
25.331056470045123
87.77966996739379,
25.144089872658203
],
[
87.47841997225677,
25.194955785182586
87.79496184531952,
25.087724942563614
],
[
87.327030380792,
25.223825627426155
87.95399737574718,
24.97362032798189
],
[
87.96011412691746,
24.921379661064957
],
[
87.89130067625166,
24.855391450222513
],
[
87.83930829130415,
24.74541109881844
],
[
87.90812174196996,
24.722040274145076
],
[
87.88977148845908,
24.565318273394276
],
[
87.79343265752695,
24.583190080497435
],
[
87.80107859648982,
24.382475939185007
],
[
87.70626895335025,
24.260122798247973
],
[
87.638984690477,
24.254623780677772
],
[
87.63133875151414,
24.163889990769412
],
[
87.44019027744244,
23.982422410952694
],
[
87.33620550754743,
24.034663077869627
],
[
87.23374992544501,
24.02503979712177
],
[
87.29491743714794,
25.089099696956165
23.90131190179219
],
[
87.1756407893272,
25.057480345927495
87.23374992544501,
23.85594500683801
],
[
87.14505703347574,
25.01898722293607
87.12976515555,
23.85319549805291
],
[
87.15729053581632,
24.88151178368098
87.08541870956536,
23.811952866276382
],
[
87.10988571424654,
24.85126718704486
86.9156788645897,
23.882065340296478
],
[
87.05177657812874,
24.627182221059066
86.80098978014666,
23.833948936557196
],
[
86.95237937161146,
24.631306484236717
86.58231592580864,
23.982422410952694
],
[
86.91262048900455,
24.547446466291113
86.48138953149879,
24.02229028833667
],
[
86.7535849585769,
24.61755894031121
86.57008242346805,
24.1418939204886
],
[
86.65265856426703,
24.570817290964477
86.48444790708393,
24.152891955629006
],
[
86.61137049386755,
24.607935659563353
],
[
86.49973978500967,
24.510328097692238
86.51503166293541,
24.2230044296491
],
[
86.4523349634399,
@@ -14911,451 +15055,6 @@
},
"id": "langMaithali"
},
{
"type": "Feature",
"properties": {
"lang_name": "Santali",
"lang_code": "sat"
},
"geometry": {
"type": "MultiPolygon",
"coordinates": [
[
[
[
85.81925121731442,
23.268924881218776
],
[
85.8834771046025,
23.35003539037928
],
[
85.85901009992133,
23.42977114514723
],
[
85.88500629239508,
23.48338656645672
],
[
86.03945425944502,
23.498508864774777
],
[
86.08227151763708,
23.565871830009772
],
[
86.15873090726576,
23.558998058047017
],
[
86.17708116077664,
23.469639022531208
],
[
86.31012049873054,
23.411899338044073
],
[
86.36517125926319,
23.531502970195998
],
[
86.48597709487652,
23.63598430402987
],
[
86.7122968881774,
23.69922300608721
],
[
86.80098978014666,
23.69922300608721
],
[
86.90191617445653,
23.63873381281497
],
[
87.01507607110698,
23.631860040852214
],
[
87.20928292076383,
23.557623303654466
],
[
87.27809637142964,
23.499883619167328
],
[
87.44936540419789,
23.402276057296216
],
[
87.55640854967804,
23.312917021780407
],
[
87.64510144164731,
23.19606289841358
],
[
87.76437808946804,
23.0750845118691
],
[
87.71238570452054,
23.01047105541921
],
[
87.64204306606216,
22.98160121317564
],
[
87.63133875151414,
22.899115949622587
],
[
87.52276641824142,
22.927985791866156
],
[
87.45701134316076,
22.912863493548095
],
[
87.35761413664346,
22.95410612532462
],
[
87.27045043246677,
22.903240212800238
],
[
87.06401008046933,
22.850999545883305
],
[
87.07624358280992,
22.725896896161174
],
[
87.09918139969852,
22.6942775451325
],
[
87.08236033398022,
22.471567333539255
],
[
87.16187809919404,
22.424825684192527
],
[
87.2046953573861,
22.303847297648048
],
[
87.1817575404975,
22.191117437458875
],
[
87.13741109451287,
22.12650398100898
],
[
87.24292505220045,
21.964282962687975
],
[
87.10835652645397,
21.924415085304
],
[
87.10071058749111,
21.86392589203176
],
[
87.00131338097381,
21.913417050163595
],
[
87.02883876124014,
22.038519699885725
],
[
86.96461287395205,
22.085261349232454
],
[
86.83769028716844,
22.097634138765414
],
[
86.72758876610314,
22.21586301652479
],
[
86.55479054554232,
22.298348280077846
],
[
86.49668140942453,
22.346464683817125
],
[
86.42939714655128,
22.316220087181005
],
[
86.3590545080929,
22.349214192602226
],
[
86.28259511846423,
22.44819650886589
],
[
86.11897202465885,
22.486689631857317
],
[
86.06697963971135,
22.556802105877413
],
[
86.14955578051031,
22.63103884307516
],
[
86.15873090726576,
22.75201722961964
],
[
86.19848978987267,
22.818005440462084
],
[
86.18778547532466,
22.94723235336187
],
[
86.24130704806473,
22.9967235114937
],
[
86.04404182282273,
23.145196985889196
],
[
85.88500629239508,
23.16719305617001
],
[
85.81925121731442,
23.268924881218776
]
]
],
[
[
[
86.4523349634399,
24.37285265843715
],
[
86.49973978500967,
24.510328097692238
],
[
86.61137049386755,
24.607935659563353
],
[
86.65265856426703,
24.570817290964477
],
[
86.7535849585769,
24.61755894031121
],
[
86.91262048900455,
24.547446466291113
],
[
86.95237937161146,
24.631306484236717
],
[
87.05177657812874,
24.627182221059066
],
[
87.10988571424654,
24.85126718704486
],
[
87.15729053581632,
24.88151178368098
],
[
87.14505703347574,
25.01898722293607
],
[
87.1756407893272,
25.057480345927495
],
[
87.29491743714794,
25.089099696956165
],
[
87.327030380792,
25.223825627426155
],
[
87.47841997225677,
25.194955785182586
],
[
87.55182098630031,
25.331056470045123
],
[
87.69250626321708,
25.31180990854941
],
[
87.71085651672797,
25.258194487239926
],
[
87.77814077960122,
25.24994596088462
],
[
87.77966996739379,
25.144089872658203
],
[
87.79496184531952,
25.087724942563614
],
[
87.95399737574718,
24.97362032798189
],
[
87.96011412691746,
24.921379661064957
],
[
87.89130067625166,
24.855391450222513
],
[
87.83930829130415,
24.74541109881844
],
[
87.90812174196996,
24.722040274145076
],
[
87.88977148845908,
24.565318273394276
],
[
87.79343265752695,
24.583190080497435
],
[
87.80107859648982,
24.382475939185007
],
[
87.70626895335025,
24.260122798247973
],
[
87.638984690477,
24.254623780677772
],
[
87.63133875151414,
24.163889990769412
],
[
87.44019027744244,
23.982422410952694
],
[
87.33620550754743,
24.034663077869627
],
[
87.23374992544501,
24.02503979712177
],
[
87.29491743714794,
23.90131190179219
],
[
87.23374992544501,
23.85594500683801
],
[
87.12976515555,
23.85319549805291
],
[
87.08541870956536,
23.811952866276382
],
[
86.9156788645897,
23.882065340296478
],
[
86.80098978014666,
23.833948936557196
],
[
86.58231592580864,
23.982422410952694
],
[
86.48138953149879,
24.02229028833667
],
[
86.57008242346805,
24.1418939204886
],
[
86.48444790708393,
24.152891955629006
],
[
86.51503166293541,
24.2230044296491
],
[
86.4523349634399,
24.37285265843715
]
]
]
]
},
"id": "langSantali"
},
{
"type": "Feature",
"properties": {
@@ -34545,7 +34244,7 @@
{
"type": "Feature",
"properties": {
"district": "Dakshina Kannada",
"district": "Dakshina Kannada",
"dt_code": "575",
"st_nm": "Karnataka",
"st_code": "29",
@@ -90915,7 +90614,7 @@
{
"type": "Feature",
"properties": {
"district": "Kutch",
"district": "Kutch",
"dt_code": "468",
"st_nm": "Gujarat",
"st_code": "24",
@@ -124468,6 +124167,6 @@
]
]
}
}
]
}
]
}

File diff suppressed because one or more lines are too long

View File

@@ -14910,451 +14910,6 @@
},
"id": "langMaithali"
},
{
"type": "Feature",
"properties": {
"lang_name": "Santali",
"lang_code": "sat"
},
"geometry": {
"type": "MultiPolygon",
"coordinates": [
[
[
[
85.81925121731442,
23.268924881218776
],
[
85.8834771046025,
23.35003539037928
],
[
85.85901009992133,
23.42977114514723
],
[
85.88500629239508,
23.48338656645672
],
[
86.03945425944502,
23.498508864774777
],
[
86.08227151763708,
23.565871830009772
],
[
86.15873090726576,
23.558998058047017
],
[
86.17708116077664,
23.469639022531208
],
[
86.31012049873054,
23.411899338044073
],
[
86.36517125926319,
23.531502970195998
],
[
86.48597709487652,
23.63598430402987
],
[
86.7122968881774,
23.69922300608721
],
[
86.80098978014666,
23.69922300608721
],
[
86.90191617445653,
23.63873381281497
],
[
87.01507607110698,
23.631860040852214
],
[
87.20928292076383,
23.557623303654466
],
[
87.27809637142964,
23.499883619167328
],
[
87.44936540419789,
23.402276057296216
],
[
87.55640854967804,
23.312917021780407
],
[
87.64510144164731,
23.19606289841358
],
[
87.76437808946804,
23.0750845118691
],
[
87.71238570452054,
23.01047105541921
],
[
87.64204306606216,
22.98160121317564
],
[
87.63133875151414,
22.899115949622587
],
[
87.52276641824142,
22.927985791866156
],
[
87.45701134316076,
22.912863493548095
],
[
87.35761413664346,
22.95410612532462
],
[
87.27045043246677,
22.903240212800238
],
[
87.06401008046933,
22.850999545883305
],
[
87.07624358280992,
22.725896896161174
],
[
87.09918139969852,
22.6942775451325
],
[
87.08236033398022,
22.471567333539255
],
[
87.16187809919404,
22.424825684192527
],
[
87.2046953573861,
22.303847297648048
],
[
87.1817575404975,
22.191117437458875
],
[
87.13741109451287,
22.12650398100898
],
[
87.24292505220045,
21.964282962687975
],
[
87.10835652645397,
21.924415085304
],
[
87.10071058749111,
21.86392589203176
],
[
87.00131338097381,
21.913417050163595
],
[
87.02883876124014,
22.038519699885725
],
[
86.96461287395205,
22.085261349232454
],
[
86.83769028716844,
22.097634138765414
],
[
86.72758876610314,
22.21586301652479
],
[
86.55479054554232,
22.298348280077846
],
[
86.49668140942453,
22.346464683817125
],
[
86.42939714655128,
22.316220087181005
],
[
86.3590545080929,
22.349214192602226
],
[
86.28259511846423,
22.44819650886589
],
[
86.11897202465885,
22.486689631857317
],
[
86.06697963971135,
22.556802105877413
],
[
86.14955578051031,
22.63103884307516
],
[
86.15873090726576,
22.75201722961964
],
[
86.19848978987267,
22.818005440462084
],
[
86.18778547532466,
22.94723235336187
],
[
86.24130704806473,
22.9967235114937
],
[
86.04404182282273,
23.145196985889196
],
[
85.88500629239508,
23.16719305617001
],
[
85.81925121731442,
23.268924881218776
]
]
],
[
[
[
86.4523349634399,
24.37285265843715
],
[
86.49973978500967,
24.510328097692238
],
[
86.61137049386755,
24.607935659563353
],
[
86.65265856426703,
24.570817290964477
],
[
86.7535849585769,
24.61755894031121
],
[
86.91262048900455,
24.547446466291113
],
[
86.95237937161146,
24.631306484236717
],
[
87.05177657812874,
24.627182221059066
],
[
87.10988571424654,
24.85126718704486
],
[
87.15729053581632,
24.88151178368098
],
[
87.14505703347574,
25.01898722293607
],
[
87.1756407893272,
25.057480345927495
],
[
87.29491743714794,
25.089099696956165
],
[
87.327030380792,
25.223825627426155
],
[
87.47841997225677,
25.194955785182586
],
[
87.55182098630031,
25.331056470045123
],
[
87.69250626321708,
25.31180990854941
],
[
87.71085651672797,
25.258194487239926
],
[
87.77814077960122,
25.24994596088462
],
[
87.77966996739379,
25.144089872658203
],
[
87.79496184531952,
25.087724942563614
],
[
87.95399737574718,
24.97362032798189
],
[
87.96011412691746,
24.921379661064957
],
[
87.89130067625166,
24.855391450222513
],
[
87.83930829130415,
24.74541109881844
],
[
87.90812174196996,
24.722040274145076
],
[
87.88977148845908,
24.565318273394276
],
[
87.79343265752695,
24.583190080497435
],
[
87.80107859648982,
24.382475939185007
],
[
87.70626895335025,
24.260122798247973
],
[
87.638984690477,
24.254623780677772
],
[
87.63133875151414,
24.163889990769412
],
[
87.44019027744244,
23.982422410952694
],
[
87.33620550754743,
24.034663077869627
],
[
87.23374992544501,
24.02503979712177
],
[
87.29491743714794,
23.90131190179219
],
[
87.23374992544501,
23.85594500683801
],
[
87.12976515555,
23.85319549805291
],
[
87.08541870956536,
23.811952866276382
],
[
86.9156788645897,
23.882065340296478
],
[
86.80098978014666,
23.833948936557196
],
[
86.58231592580864,
23.982422410952694
],
[
86.48138953149879,
24.02229028833667
],
[
86.57008242346805,
24.1418939204886
],
[
86.48444790708393,
24.152891955629006
],
[
86.51503166293541,
24.2230044296491
],
[
86.4523349634399,
24.37285265843715
]
]
]
]
},
"id": "langSantali"
},
{
"type": "Feature",
"properties": {

View File

@@ -13,7 +13,6 @@ Mizo
Assamese
Punjabi
Maithili
Santali
Nepali
Konkani
Tulu

3
server.py Normal file
View File

@@ -0,0 +1,3 @@
from ai4bharat.transliteration import xlit_server
app, engine = xlit_server.get_app()
app.run(host='0.0.0.0', port=10000)

Binary file not shown.

View File

@@ -1,5 +1,6 @@
function hideText(request) {
function hideTranslationsAndShowText(request) {
document.querySelectorAll(".translationText, .romanizationText").forEach(element => element.style.visibility = 'hidden')
document.getElementById("fetchingText").style.visibility = "visible";
}
function updateTranslations(response) {
@@ -14,6 +15,7 @@ function updateTranslations(response) {
// bar used to track translations, and then remove it in the 'resolved' handler.
const elem = document.getElementById("loading-screen")
elem.classList.toggle("loading")
document.getElementById("fetchingText").textContent = "Fetching romanizations..."
fetch("/romanize", {
method: "POST",
body: response
@@ -29,5 +31,7 @@ function updateTranslations(response) {
});
// Show elements again
document.querySelectorAll(".translationText, .romanizationText").forEach(element => element.style.visibility = 'visible')
document.getElementById("fetchingText").textContent = "Fetching translations..." // Restore the original text content
document.getElementById("fetchingText").style.visibility = "hidden"
});
}