OneLocale

OneLocale — simple, powerful i18n for AutoHotkey v2

License AutoHotkey v2 View on GitHub

OneLocale logo

Write your GUI strings in plain English (or your language of choice) today — add translations tomorrow without touching your code again.

OneLocale in action

What you get

Quick Start (runs out of the box)

; MyScript.ahk
#Requires AutoHotkey v2.0
#Include lib/OneLocale.ahk
S_VERSION := "1.0"
locale_info := OneLocale_Init() ; reads MyScript.ini → picks best language
if (!locale_info.success) {
    MsgBox(locale_info.errmsg, , "icon!")
    ExitApp
}
G := Gui("-MaximizeBox -MinimizeBox")
G.Title := sT("gui", "title", "/My Cool App v%ver%", {ver:S_VERSION})

G.Add("Text", "x16 w400 r9", sT("welcome", "[section]"))
    .SetFont("s10")

G.Add("Button", "x314 w100 Default", sT("gui", "btn_quit", "/&Quit"))
    .OnEvent("Click", (*) => ExitApp())

SB := G.Add("StatusBar", "vStatus1")
SB.SetText(sT("status", "ready", "/Ready"))

G.Show("w430 center")
return
; MyScript.ini
; • 'language=' is optional – leave empty to auto-detect using A_Language
[general]
;language = de
;MyScript-[en].lang
[gui]
title = My Cool App v%ver%
btn_quit = &OK

[welcome]
OneLocale provides an easier way to support multiple user-interface \w
languages in AutoHotkey.\n
Even if you don’t plan to support multiple languages, the way OneLocale \w
helps distinguish user-interface text from other string literals in \w
your code is valuable for code maintenance.

[status]
ready = Ready
wait  = Wait

;MyScript-[de].lang
[gui]
title    = Mein Cooles Programm v%ver%
btn_quit = &Beenden

[welcome]
OneLocale macht die Unterstützung mehrerer Sprachen für die \w
Benutzeroberfläche in AutoHotkey deutlich einfacher.\n
Selbst wenn Sie keine Mehrsprachigkeit planen, ist die Art und Weise, \w
wie OneLocale Text für die Oberfläche von anderen Zeichenketten im \w
Code klar abgrenzt, äußerst wertvoll für die Wartbarkeit Ihres Programms.

[status]
ready    = Bereit
wait     = Warten

[general]
translator = Grok

Now drop OneLocale.ahk in a \lib subfolder, and put MyScript-[en].lang and MyScript-[de].lang in a \lang subfolder. Switch language instantly by editing the ini or using the included chooser dialog (not shown here, but seen in this Demo)

Full Documentation

Helper apps

Browsing the source code of these apps should give you some ideas. All sample and demo code is public domain BTW, marked CC0 1.0.

Why people love it

There are a couple of i18n libraries floating around the forums right now. OneLocale simply gives you the most complete, v2-native feature set today — without drama, without legacy baggage, and with the cleanest developer + translator experience.

That’s it.

Contributing

Bug reports, translations, or just a “this saved me hours” are all very welcome ♥ Open an issue or PR — I usually reply the same day.

AutoHotkey Community discussion

License

GNU Lesser General Public License v2.1 – use commercially, modify, ship in closed-source apps, all no problem. Full text in LICENSE.

About

OneLocale was first created in February 2023, and has been slowly refined as it was used in many of my personal projects.

I’ve been doing this class of software for awhile. OneLocale is a complete rework of my 2013 NetText project (sourceforge) and there’s other work going back a few years before that.

raffriff42