npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

i18n-autohotkey

v1.0.0

Published

Internationalization library for AutoHotKey programs.

Downloads

2

Readme

i18n-autohotkey

An internationalization and localization library for AutoHotKey programs.

There is also a program with a GUI to help you translate your projects.

Table of contents

Getting started

Download the latest release and import the content to your program directory.

Read the instructions or check the sample project below.

Instructions

  • Go in the folder i18n and create your first INI language file (example: en-US.ini).

    • All keys must be declared in the [Strings] section.
    • You can add dynamic arguments in the key value with {1}, {2}, etc...
  • Declare a new global object named i18nService.

    • Global i18nService := New i18n(LanguageFolder, LanguageFile, [DevMode])
    • If DevMode is set to True, it will trigger some alerts for missing strings when you execute your program.
  • Whenever you want to internationalize a string, make a call to function Translate.

    str := Translate("KeyName", [arg1, arg2, ...])

Sample project

Here's an example of an en-US.ini file:

[Strings]
HelloWorld=Hello world!
Greetings=Welcome in {1}.

Here's an example of a working script featuring i18n (it will work given you have the associated fr-FR.ini file in your language folder):

#Include lib\i18n.ahk

MyAppName := "Sample Project"

Global i18nService := New i18n("i18n", "en-US")

MsgBox % Translate("HelloWorld")
MsgBox % Translate("Greetings", [MyAppName])

; You can dynamically change the language without reloading the program

i18nService := New i18n("i18n", "fr-FR")

MsgBox % Translate("HelloWorld")
MsgBox % Translate("Greetings", [MyAppName])

You can download this sample project on the releases page.

Advanced sample project

Here is an example of a project using a GUI, multiline and imbricated translation (you download this sample project on the releases page).

#Include lib\i18n.ahk

Global i18nService := New i18n("i18n", "en-US", True)

Gui, Add, Button,   ,Switch Language
Gui, Add, Text,     vTextGui w150,% Translate("TextGui")
Gui, Add, Button,   ,Demo
Gui, Show,          w300 h200

toggled := False
return

GetVar(var){
    global
    return %var%
}

ButtonSwitchLanguage:
    If !toggled
        lang := "fr-FR"
    Else
        lang := "en-US"
    i18nService := New i18n("i18n", lang, True)
    GuiControl, Text, TextGui, % Translate("TextGui")
    toggled := !toggled
return

ButtonDemo:
    ; #1 - Basic translation
    MsgBox,,    % "#1", % Translate("Basic")

    ; #2a - Argument
    TitleApp := "Translation Helper"
    MsgBox,,    % "#2a", % Translate("Greetings", [TitleApp])

    ; #2b - Example multiple arguments
    colors :=   [Translate("Blue"), Translate("White"), Translate("Red")]
    MsgBox,,    % "#2b", % Translate("Flag", [colors[1], colors[2], colors[3]])

    ; #3 - Multiline
    ; To Do
    ; #4 - Example complex MsgBox
    MsgBox,     48, % "#4 " Translate("ComplexTitle", [GetVar("TitleApp")]), % Translate("Complex", [colors[3], colors[1]])
return

F12::
    ExitApp
    return

Translation Helper

To be written.