From 2802d52372754107d25342f65751a5f7de0358df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dawid=20Wysoki=C5=84ski?= Date: Sun, 25 Jun 2023 09:08:45 +0200 Subject: [PATCH 1/8] feat: ci/cd - validate translations --- .drone.yml | 21 ++++++++++++++++++++- Makefile | 4 ++++ validate_translations.sh | 20 ++++++++++++++++++++ 3 files changed, 44 insertions(+), 1 deletion(-) create mode 100755 validate_translations.sh diff --git a/.drone.yml b/.drone.yml index 59aa8fa..9b62693 100644 --- a/.drone.yml +++ b/.drone.yml @@ -67,6 +67,25 @@ trigger: branch: - master +--- +kind: pipeline +type: docker +name: translations + +steps: + - name: validate + image: ubuntu:22.04 + commands: + - apt install jq + - make validate-translations + +trigger: + event: + - push + - pull_request + branch: + - master + --- kind: pipeline type: docker @@ -372,6 +391,6 @@ depends_on: - migrations-manifest --- kind: signature -hmac: adb6f2a2d07f26eb833ea4cac0f54bb6aea7bc53a38d423afe7408701b270ac2 +hmac: 8baa6a7cde3870e6638643031cf54044a5b816a0963274db27b9fa44af18df4b ... diff --git a/Makefile b/Makefile index a313619..e0c7c42 100644 --- a/Makefile +++ b/Makefile @@ -47,3 +47,7 @@ create-sql-migration: install-goose .PHONY: validate-migrations validate-migrations: install-goose @goose -dir migrations -v validate + +.PHONY: validate-translations +validate-translations: + @./validate_translations.sh diff --git a/validate_translations.sh b/validate_translations.sh new file mode 100755 index 0000000..e670ab2 --- /dev/null +++ b/validate_translations.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +LOCALE_EN_PATH="./internal/discord/internal/discordi18n/locale.en.json" + +status=0 + +for path in ./internal/discord/internal/discordi18n/locale.*.json; do + if [ "$path" = $LOCALE_EN_PATH ]; then + continue + fi + echo "----- ${path}" + if diff <(jq 'keys' $LOCALE_EN_PATH) <(jq 'keys' "$path"); then + echo "----- Success" + else + status=1 + echo "----- Failed" + fi +done + +exit "$status" -- 2.40.1 From fda287107c39a704c52bed0ac76bbfc3c72ec1d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dawid=20Wysoki=C5=84ski?= Date: Sun, 25 Jun 2023 09:09:40 +0200 Subject: [PATCH 2/8] feat: ci/cd - validate translations --- .drone.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.drone.yml b/.drone.yml index 9b62693..1718e0a 100644 --- a/.drone.yml +++ b/.drone.yml @@ -76,7 +76,7 @@ steps: - name: validate image: ubuntu:22.04 commands: - - apt install jq + - apt update && apt install jq - make validate-translations trigger: @@ -391,6 +391,6 @@ depends_on: - migrations-manifest --- kind: signature -hmac: 8baa6a7cde3870e6638643031cf54044a5b816a0963274db27b9fa44af18df4b +hmac: 427f86e70b5eb59ac636faa976092e9e142ad43f2aad676481a0b43228fdc69c ... -- 2.40.1 From c85cc92b5ed5d93db14838ba6d9c894c3f598559 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dawid=20Wysoki=C5=84ski?= Date: Sun, 25 Jun 2023 09:11:04 +0200 Subject: [PATCH 3/8] feat: ci/cd - validate translations --- .drone.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index 1718e0a..a748d65 100644 --- a/.drone.yml +++ b/.drone.yml @@ -76,7 +76,7 @@ steps: - name: validate image: ubuntu:22.04 commands: - - apt update && apt install jq + - apt update && apt -y install jq - make validate-translations trigger: -- 2.40.1 From 9c0d691521519ed075893ddfdb765d1fc652cb17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dawid=20Wysoki=C5=84ski?= Date: Sun, 25 Jun 2023 09:11:37 +0200 Subject: [PATCH 4/8] feat: ci/cd - validate translations --- .drone.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index a748d65..23b2505 100644 --- a/.drone.yml +++ b/.drone.yml @@ -391,6 +391,6 @@ depends_on: - migrations-manifest --- kind: signature -hmac: 427f86e70b5eb59ac636faa976092e9e142ad43f2aad676481a0b43228fdc69c +hmac: 8fcd1d6d5a88d1dbe0310e3b19418a23f7d14a7f5171ecebdb474aa097b9cc58 ... -- 2.40.1 From 28e04b70f32e89fcc374bd4b5b1907160728fa9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dawid=20Wysoki=C5=84ski?= Date: Sun, 25 Jun 2023 09:12:03 +0200 Subject: [PATCH 5/8] feat: ci/cd - validate translations --- .drone.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.drone.yml b/.drone.yml index 23b2505..d517f0d 100644 --- a/.drone.yml +++ b/.drone.yml @@ -76,7 +76,7 @@ steps: - name: validate image: ubuntu:22.04 commands: - - apt update && apt -y install jq + - apt update && apt -y install jq make - make validate-translations trigger: @@ -391,6 +391,6 @@ depends_on: - migrations-manifest --- kind: signature -hmac: 8fcd1d6d5a88d1dbe0310e3b19418a23f7d14a7f5171ecebdb474aa097b9cc58 +hmac: 8726b4787be3c0dec9ef810558be23289f56bdbb5c2d05623a4156084974450c ... -- 2.40.1 From 435b11a36b7ac38bba69923795c1a03238a57ac9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dawid=20Wysoki=C5=84ski?= Date: Sun, 25 Jun 2023 09:13:52 +0200 Subject: [PATCH 6/8] feat: ci/cd - validate translations --- .drone.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.drone.yml b/.drone.yml index d517f0d..e991cd4 100644 --- a/.drone.yml +++ b/.drone.yml @@ -74,9 +74,10 @@ name: translations steps: - name: validate - image: ubuntu:22.04 + image: golang:1.20 + pull: always commands: - - apt update && apt -y install jq make + - apt update && apt -y install jq - make validate-translations trigger: @@ -391,6 +392,6 @@ depends_on: - migrations-manifest --- kind: signature -hmac: 8726b4787be3c0dec9ef810558be23289f56bdbb5c2d05623a4156084974450c +hmac: 4fa2583c281aacc0e4d0dc87296a2ce6ff7facf71d1ce2e9f5d4157b35635d4f ... -- 2.40.1 From ffdef871a197183a6f0e620900093a352cacd3ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dawid=20Wysoki=C5=84ski?= Date: Sun, 25 Jun 2023 09:14:46 +0200 Subject: [PATCH 7/8] feat: ci/cd - validate translations --- .../internal/discordi18n/locale.anything.json | 55 +++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 internal/discord/internal/discordi18n/locale.anything.json diff --git a/internal/discord/internal/discordi18n/locale.anything.json b/internal/discord/internal/discordi18n/locale.anything.json new file mode 100644 index 0000000..a188de2 --- /dev/null +++ b/internal/discord/internal/discordi18n/locale.anything.json @@ -0,0 +1,55 @@ +{ + "cmd.group.create.description": "Creates a new monitor group", + "cmd.group.create.option.version.description": "e.g. www.tribalwars.net, www.plemiona.pl", + "cmd.group.create.option.server.description": "Tribal Wars server (e.g. en115, pl170)", + "cmd.group.create.option.internals.description": "Show conquers in the same group", + "cmd.group.create.option.barbarians.description": "Show barbarian conquers", + "cmd.group.create.option.channel-gains.description": "Channel where notifications of gained villages will appear", + "cmd.group.create.option.channel-losses.description": "Channel where notifications of lost villages will appear", + "cmd.group.create.success": "The group has been successfully created (id={{ .GroupID }}).", + + "cmd.group.list.description": "Lists all created groups on this server", + "cmd.group.list.embed.title": "Group list", + "cmd.group.list.embed.field.value": "**Server**: {{ .ServerKey }}\n**Channel gains**: {{ .ChannelGains }}\n**Channel losses**: {{ .ChannelLosses }}\n**Internals**: {{ .Internals }}\n **Barbarians**: {{ .Barbarians }}\n **Number of monitored tribes**: {{ .NumTribes }}", + + "cmd.group.details.description": "Displays group details (including added tribes)", + "cmd.group.details.embed.description": "**Server**: {{ .ServerKey }}\n**Channel gains**: {{ .ChannelGains }}\n**Channel losses**: {{ .ChannelLosses }}\n**Internals**: {{ .Internals }}\n **Barbarians**: {{ .Barbarians }}\n **Tribes**: {{ .Tribes }}", + + "cmd.group.tribe.description": "Manages tribes in a group", + + "cmd.group.tribe.add.description": "Adds a tribe to a group", + "cmd.group.tribe.add.option.group.description": "Group ID", + "cmd.group.tribe.add.option.tag.description": "Tribe tag", + "cmd.group.tribe.add.success": "The tribe has been successfully added to the group.", + + "cmd.group.tribe.remove.description": "Removes a tribe from a group", + "cmd.group.tribe.remove.option.group.description": "Group ID", + "cmd.group.tribe.remove.option.tag.description": "Tribe tag", + "cmd.group.tribe.remove.success": "The tribe has been successfully removed from the group.", + + "cmd.group.set.description": "Sets various properties in group configuration", + + "cmd.group.set.channel-gains.description": "Enables/disables notifications of gained villages", + "cmd.group.set.channel-gains.option.group.description": "Group ID", + "cmd.group.set.channel-gains.option.channel.description": "Channel where notifications of gained villages will appear", + "cmd.group.set.channel-gains.success": "The group has been successfully updated.", + + "cmd.group.set.channel-losses.description": "Enables/disables notifications of lost villages", + "cmd.group.set.channel-losses.option.group.description": "Group ID", + "cmd.group.set.channel-losses.option.channel.description": "Channel where notifications of lost villages will appear", + "cmd.group.set.channel-losses.success": "The group has been successfully updated.", + + "cmd.group.set.internals.description": "Enables/disables notifications of internal conquers", + "cmd.group.set.internals.option.group.description": "Group ID", + "cmd.group.set.internals.option.internals.description": "Show conquers in the same group", + "cmd.group.set.internals.success": "The group has been successfully updated.", + + "cmd.group.set.barbarians.description": "Enables/disables notifications of barbarian conquers", + "cmd.group.set.barbarians.option.group.description": "Group ID", + "cmd.group.set.barbarians.option.barbarians.description": "Show barbarian conquers", + "cmd.group.set.barbarians.success": "The group has been successfully updated.", + + "cmd.group.delete.description": "Deletes a group", + "cmd.group.delete.option.group.description": "Group ID", + "cmd.group.delete.success": "The group has been successfully deleted." +} -- 2.40.1 From 7844f6fafc02517dc198a7d7dd77fe3c2c60bc7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dawid=20Wysoki=C5=84ski?= Date: Sun, 25 Jun 2023 09:15:25 +0200 Subject: [PATCH 8/8] feat: ci/cd - validate translations --- .../internal/discordi18n/locale.anything.json | 55 ------------------- 1 file changed, 55 deletions(-) delete mode 100644 internal/discord/internal/discordi18n/locale.anything.json diff --git a/internal/discord/internal/discordi18n/locale.anything.json b/internal/discord/internal/discordi18n/locale.anything.json deleted file mode 100644 index a188de2..0000000 --- a/internal/discord/internal/discordi18n/locale.anything.json +++ /dev/null @@ -1,55 +0,0 @@ -{ - "cmd.group.create.description": "Creates a new monitor group", - "cmd.group.create.option.version.description": "e.g. www.tribalwars.net, www.plemiona.pl", - "cmd.group.create.option.server.description": "Tribal Wars server (e.g. en115, pl170)", - "cmd.group.create.option.internals.description": "Show conquers in the same group", - "cmd.group.create.option.barbarians.description": "Show barbarian conquers", - "cmd.group.create.option.channel-gains.description": "Channel where notifications of gained villages will appear", - "cmd.group.create.option.channel-losses.description": "Channel where notifications of lost villages will appear", - "cmd.group.create.success": "The group has been successfully created (id={{ .GroupID }}).", - - "cmd.group.list.description": "Lists all created groups on this server", - "cmd.group.list.embed.title": "Group list", - "cmd.group.list.embed.field.value": "**Server**: {{ .ServerKey }}\n**Channel gains**: {{ .ChannelGains }}\n**Channel losses**: {{ .ChannelLosses }}\n**Internals**: {{ .Internals }}\n **Barbarians**: {{ .Barbarians }}\n **Number of monitored tribes**: {{ .NumTribes }}", - - "cmd.group.details.description": "Displays group details (including added tribes)", - "cmd.group.details.embed.description": "**Server**: {{ .ServerKey }}\n**Channel gains**: {{ .ChannelGains }}\n**Channel losses**: {{ .ChannelLosses }}\n**Internals**: {{ .Internals }}\n **Barbarians**: {{ .Barbarians }}\n **Tribes**: {{ .Tribes }}", - - "cmd.group.tribe.description": "Manages tribes in a group", - - "cmd.group.tribe.add.description": "Adds a tribe to a group", - "cmd.group.tribe.add.option.group.description": "Group ID", - "cmd.group.tribe.add.option.tag.description": "Tribe tag", - "cmd.group.tribe.add.success": "The tribe has been successfully added to the group.", - - "cmd.group.tribe.remove.description": "Removes a tribe from a group", - "cmd.group.tribe.remove.option.group.description": "Group ID", - "cmd.group.tribe.remove.option.tag.description": "Tribe tag", - "cmd.group.tribe.remove.success": "The tribe has been successfully removed from the group.", - - "cmd.group.set.description": "Sets various properties in group configuration", - - "cmd.group.set.channel-gains.description": "Enables/disables notifications of gained villages", - "cmd.group.set.channel-gains.option.group.description": "Group ID", - "cmd.group.set.channel-gains.option.channel.description": "Channel where notifications of gained villages will appear", - "cmd.group.set.channel-gains.success": "The group has been successfully updated.", - - "cmd.group.set.channel-losses.description": "Enables/disables notifications of lost villages", - "cmd.group.set.channel-losses.option.group.description": "Group ID", - "cmd.group.set.channel-losses.option.channel.description": "Channel where notifications of lost villages will appear", - "cmd.group.set.channel-losses.success": "The group has been successfully updated.", - - "cmd.group.set.internals.description": "Enables/disables notifications of internal conquers", - "cmd.group.set.internals.option.group.description": "Group ID", - "cmd.group.set.internals.option.internals.description": "Show conquers in the same group", - "cmd.group.set.internals.success": "The group has been successfully updated.", - - "cmd.group.set.barbarians.description": "Enables/disables notifications of barbarian conquers", - "cmd.group.set.barbarians.option.group.description": "Group ID", - "cmd.group.set.barbarians.option.barbarians.description": "Show barbarian conquers", - "cmd.group.set.barbarians.success": "The group has been successfully updated.", - - "cmd.group.delete.description": "Deletes a group", - "cmd.group.delete.option.group.description": "Group ID", - "cmd.group.delete.success": "The group has been successfully deleted." -} -- 2.40.1