Skip to content
Merged
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
2 changes: 1 addition & 1 deletion .github/workflows/ci-workflow.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Astrolib Continuous Integration
name: Mamba Continuous Integration

on:
push:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-workflow.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Astrolib Release
name: Mamba Release

on:
push:
Expand Down
2 changes: 1 addition & 1 deletion .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ before:
# - go mod generate

builds:
- id: "astrolib"
- id: "mamba"
env:
- CGO_ENABLED=0
goos:
Expand Down
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"--fast"
],
"cSpell.words": [
"astrolib",
"mamba",
"bodyclose",
"chzyer",
"cmds",
Expand Down
28 changes: 14 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# 🌟 astrolib: ___Go template for library modules___
# 🌟 mamba: ___Go template for library modules___

[![A B](https://img.shields.io/badge/branching-commonflow-informational?style=flat)](https://commonflow.org)
[![A B](https://img.shields.io/badge/merge-rebase-informational?style=flat)](https://git-scm.com/book/en/v2/Git-Branching-Rebasing)
[![A B](https://img.shields.io/badge/branch%20history-linear-blue?style=flat)](https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/defining-the-mergeability-of-pull-requests/managing-a-branch-protection-rule)
[![Go Reference](https://pkg.go.dev/badge/github.com/snivilised/astrolib.svg)](https://pkg.go.dev/github.com/snivilised/astrolib)
[![Go report](https://goreportcard.com/badge/github.com/snivilised/astrolib)](https://goreportcard.com/report/github.com/snivilised/astrolib)
[![Coverage Status](https://coveralls.io/repos/github/snivilised/astrolib/badge.svg?branch=main)](https://coveralls.io/github/snivilised/astrolib?branch=main&kill_cache=1)
[![Astrolib Continuous Integration](https://github.com/snivilised/astrolib/actions/workflows/ci-workflow.yml/badge.svg)](https://github.com/snivilised/astrolib/actions/workflows/ci-workflow.yml)
[![Go Reference](https://pkg.go.dev/badge/github.com/snivilised/mamba.svg)](https://pkg.go.dev/github.com/snivilised/mamba)
[![Go report](https://goreportcard.com/badge/github.com/snivilised/mamba)](https://goreportcard.com/report/github.com/snivilised/mamba)
[![Coverage Status](https://coveralls.io/repos/github/snivilised/mamba/badge.svg?branch=main)](https://coveralls.io/github/snivilised/mamba?branch=main&kill_cache=1)
[![Mamba Continuous Integration](https://github.com/snivilised/mamba/actions/workflows/ci-workflow.yml/badge.svg)](https://github.com/snivilised/mamba/actions/workflows/ci-workflow.yml)
[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)](https://github.com/pre-commit/pre-commit)
[![A B](https://img.shields.io/badge/commit-conventional-commits?style=flat)](https://www.conventionalcommits.org/)

Expand Down Expand Up @@ -53,38 +53,38 @@ By using this template, there is no need to use the cobra-cli to scaffold your a

### 📝 Checklist of required changes

The following is list of actions that must be performed before using this template. Most of the changes concern changing the name `astrolib` to the name of the new application. As the template is instantiated from github, the new name will automatically replace the top level directory name, that being ___astrolib___.
The following is list of actions that must be performed before using this template. Most of the changes concern changing the name `mamba` to the name of the new application. As the template is instantiated from github, the new name will automatically replace the top level directory name, that being ___mamba___.

➕ The following descriptions use owner name ___pandora___ and repo name ___maestro___ as an example. That is to say the client has instantiated ___astrolib___ template into github at url _github.com/pandora/maestro_
➕ The following descriptions use owner name ___pandora___ and repo name ___maestro___ as an example. That is to say the client has instantiated ___mamba___ template into github at url _github.com/pandora/maestro_

#### 🤖 Automated changes

Automated via `automate-checklist.sh` script. When the user instantiates the repo, a github actions workflow is executed which applies changes to the clients repo automatically. The following description describes the changes that are applied on the user's behalf and the workflow is automatically deleted. However, there are other changes that should be made. These compose the manual checklist and should be heeded by the user.

##### ✅ Rename import statements

+ `rename import paths`: global search and replace ___snivilised/astrolib___ to ___pandora/maestro___
+ `rename import paths`: global search and replace ___snivilised/mamba___ to ___pandora/maestro___

##### ✅ Identifiers

+ `change astrolibTemplData`: perform a refactor rename (_Rename Symbol_) to ___maestroTemplData___
+ `change mambaTemplData`: perform a refactor rename (_Rename Symbol_) to ___maestroTemplData___

##### ✅ Global search replace astrolib to maestro
##### ✅ Global search replace mamba to maestro

Will take care of the following required changes:

+ `change module name`: update the module name inside the .mod file in the root directory
+ `change ApplicationName`: modify to reflect the new application name. This application name is incorporated into the name of any translation files to be loaded.
+ `update BINARY_NAME`: Inside _Taskfile.yml_, change the value of ___BINARY_NAME___ to the name of the client application.
+ `update github action workflows`: change the name of the workflows in the .yaml files to replace ___astrolib___ to ___Maestro___ (note the change of case, if this is important).
+ `update github action workflows`: change the name of the workflows in the .yaml files to replace ___mamba___ to ___Maestro___ (note the change of case, if this is important).

##### ✅ Localisation/Internationalisation

+ `change the names of the translation files`: eg change ___astrolib.active.en-GB.json___ to ___maestro.active.en-GB.json___
+ `change the names of the translation files`: eg change ___mamba.active.en-GB.json___ to ___maestro.active.en-GB.json___

##### ✅ Miscellaneous automated changes

+ `reset version files`: this is optional because the release process automatically updates the version number according to the tag specified by the user, but will initially contain the version number which reflects the current value of astrolib at the time the client project is instantiated.
+ `reset version files`: this is optional because the release process automatically updates the version number according to the tag specified by the user, but will initially contain the version number which reflects the current value of mamba at the time the client project is instantiated.
+ `change SOURCE_ID`: to "github.com/pandora/maestro"

#### 🖐 Manual changes
Expand Down Expand Up @@ -125,7 +125,7 @@ Of course, its up to the user what settings they use in their repo, these are ju

### 🌐 l10n Translations

This template has been setup to support localisation. The default language is `en-GB` with support for `en-US`. There is a translation file for `en-US` defined as __src/i18n/deploy/astrolib.active.en-US.json__. This is the initial translation for `en-US` that should be deployed with the app.
This template has been setup to support localisation. The default language is `en-GB` with support for `en-US`. There is a translation file for `en-US` defined as __src/i18n/deploy/mamba.active.en-US.json__. This is the initial translation for `en-US` that should be deployed with the app.

Make sure that the go-i18n package has been installed so that it can be invoked as cli, see [go-i18n](https://github.com/nicksnyder/go-i18n) for installation instructions.

Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v0.3.4
v0.1.0
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/snivilised/astrolib
module github.com/snivilised/mamba

go 1.26.0

Expand Down
6 changes: 3 additions & 3 deletions locale/messages-errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@ import (
// that this message has been removed from the translation files, so
// it is not useable at run time.
type FooBarTemplData struct {
astrolibTemplData
mambaTemplData
Path string
Reason error
}

// the ID should use spp/library specific code, so replace astrolib with the
// the ID should use spp/library specific code, so replace mamba with the
// name of the library implementing this template project.
func (td FooBarTemplData) Message() *i18n.Message {
return &i18n.Message{
ID: "foo-bar.astrolib.nav",
ID: "foo-bar.mamba.nav",
Description: "Foo Bar description",
Other: "foo bar failure '{{.Path}}' (reason: {{.Reason}})",
}
Expand Down
2 changes: 1 addition & 1 deletion locale/messages-general.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
)

type UsingConfigFileTemplData struct {
astrolibTemplData
mambaTemplData
ConfigFileName string
}

Expand Down
10 changes: 5 additions & 5 deletions locale/translate-defs.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package locale

// CLIENT-TODO: Should be updated to use url of the implementing project,
// so should not be left as astrolib. (this should be set by auto-check)
const AstrolibSourceID = "github.com/snivilised/astrolib"
// so should not be left as mamba. (this should be set by auto-check)
const MambaSourceID = "github.com/snivilised/mamba"

type astrolibTemplData struct{}
type mambaTemplData struct{}

func (td astrolibTemplData) SourceID() string {
return AstrolibSourceID
func (td mambaTemplData) SourceID() string {
return MambaSourceID
}
14 changes: 7 additions & 7 deletions resources/doc/i18n-README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@ The local directory structure is as follows:

- ___default___: contains the translation file created by the __newt__ (new translation task). Actually, this task creates an __active__ file (`active.en-GB.json`) in the `i18n/out` folder, the result of which needs to be manually copied into the __active__ file in the `default` folder.

- ___deploy___: contains all the translations files that are intended to be deployed with the application. There will be one per supported language and by default this template project includes a translation file for __en-US__ (`astrolib.active.en-US.json`)
- ___deploy___: contains all the translations files that are intended to be deployed with the application. There will be one per supported language and by default this template project includes a translation file for __en-US__ (`mamba.active.en-US.json`)

## ⚙️ Translation Workflow

### ✨ New Translations

__goi18n__ instructs the user to manually create an empty translation message file that they want to add (eg `translate.en-US.json`). This is taken care of by the __newt__ task. Then the requirement is to run the goi18n merge \<active\> command (goi18n merge `astrolib.active.en-US.json` `astrolib.translate.en-US.json`). This has been wrapped up into the __merge__ task and the result is that the translation file `astrolib.translation.en-US.json` is populated with the messages to be translated. So the sequence goes:
__goi18n__ instructs the user to manually create an empty translation message file that they want to add (eg `translate.en-US.json`). This is taken care of by the __newt__ task. Then the requirement is to run the goi18n merge \<active\> command (goi18n merge `mamba.active.en-US.json` `mamba.translate.en-US.json`). This has been wrapped up into the __merge__ task and the result is that the translation file `mamba.translation.en-US.json` is populated with the messages to be translated. So the sequence goes:

- run __newt__ task: (generates default language file `./src/i18n/out/active.en-GB.json` and empty `./src/i18n/out/us-US/astrolib.translation.en-US.json` file). This task can be run from the root folder, __goi18n__ will recursively search the directory tree for files with translate-able content, ie files with template definitions (___i18n.Message___)
- run __merge__ task: derives a translation file for the requested language __en-US__ using 2 files as inputs: source active file (`./src/i18n/out/active.en-GB.json`) and the empty __en-US__ translate file (`./src/i18n/out/us-US/astrolib.translation.en-US.json`), both of which were generated in the previous step.
- run __newt__ task: (generates default language file `./src/i18n/out/active.en-GB.json` and empty `./src/i18n/out/us-US/mamba.translation.en-US.json` file). This task can be run from the root folder, __goi18n__ will recursively search the directory tree for files with translate-able content, ie files with template definitions (___i18n.Message___)
- run __merge__ task: derives a translation file for the requested language __en-US__ using 2 files as inputs: source active file (`./src/i18n/out/active.en-GB.json`) and the empty __en-US__ translate file (`./src/i18n/out/us-US/mamba.translation.en-US.json`), both of which were generated in the previous step.
- hand the translate file to your translator for them to translate
- rename the translate file to the active equivalent (`astrolib.translation.en-US.json`). Save this into the __deploy__ folder. This file will be deployed with the application.
- rename the translate file to the active equivalent (`mamba.translation.en-US.json`). Save this into the __deploy__ folder. This file will be deployed with the application.

### 🧩 Update Existing Translations (⚠️ not finalised)

Expand All @@ -36,7 +36,7 @@ However, in this template, the user can execute the following steps:

- run task __update__: this will re-extract messages into `active.en-GB.json` and then runs merge to create an updated translate file.
- hand the translate file to your translator for them to translate
- as before, this translated file should be used to update the active file `astrolib.active.en-US.json` inside the __deploy__ folder.
- as before, this translated file should be used to update the active file `mamba.active.en-US.json` inside the __deploy__ folder.

## 🎓 Task Reference

Expand Down Expand Up @@ -64,7 +64,7 @@ Outputs:
Inputs:

- ./src/i18n/out/active.en-GB.json
- ./src/i18n/out/en-US/astrolib.translate-en-US.json
- ./src/i18n/out/en-US/mamba.translate-en-US.json

Outputs:

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"foo-bar.astrolib.unit-test": {
"foo-bar.mamba.unit-test": {
"description": "foo bar",
"hash": "sha1-d53a205a336e07cf9eac45471b3870f9489288ec",
"other": "foo bar"
Expand Down
Loading