Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ rnd
packages/*/tests/test-tmp/
dist
**/*.tsbuildinfo
packages/go/main
3 changes: 3 additions & 0 deletions packages/go/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module adapter

go 1.24.6
59 changes: 59 additions & 0 deletions packages/go/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{
"name": "@wuchale/go",
"version": "0.1.0",
"description": "Protobuf-like i18n from plain code: Golang adapter",
"scripts": {
"dev": "tsc --watch",
"build": "tsc",
"test": "go build src/main.go && ./main tests/test.go"
},
"keywords": [
"i18n",
"internationalization",
"translation",
"gettext",
"golang",
"go",
"vite",
"po",
"go-i18n",
"golang-i18n",
"vite-plugin",
"compile-time",
"ast",
"gemini",
"translation-tooling",
"multilingual",
"localization",
"l10n",
"lingui",
"automatic-i18n",
"lightweight"
],
"files": [
],
"exports": {
".": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
},
"./runtime.svelte": "./src/runtime.svelte"
},
"repository": {
"type": "git",
"url": "git+https://github.com/wuchalejs/wuchale.git"
},
"homepage": "https://wuchale.dev",
"bugs": "https://github.com/wuchalejs/wuchale/issues",
"author": "K1DV5",
"license": "MIT",
"dependencies": {
"svelte": "^5.37.0",
"wuchale": "^0.17.1"
},
"devDependencies": {
"acorn": "^8.15.0",
"typescript": "^5.9.3"
},
"type": "module"
}
34 changes: 34 additions & 0 deletions packages/go/src/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// $ cd .. && npm run test

package main

import (
"fmt"
"go/parser"
"go/token"
"go/ast"
"os"
)

func main() {
if len(os.Args) == 1 {
fmt.Println("File required")
return
}
filename := os.Args[1]
fs := token.NewFileSet()
node, err := parser.ParseFile(fs, filename, nil, parser.ParseComments)
if err != nil {
fmt.Println("error", err)
}
for _, decl := range node.Decls {
switch d := decl.(type) {
case *ast.GenDecl:
fmt.Println("general", d)
case *ast.FuncDecl:
fmt.Println("func", d)
default:
fmt.Println("def", d)
}
}
}
15 changes: 15 additions & 0 deletions packages/go/tests/test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package tests

import (
"fmt"
)

func foo() string {
x := "Hello"
fmt.Println("Hello")
return x
}

func main() {
fmt.Println(foo())
}
Loading