Skip to content

Commit

Permalink
Merge branch 'localization'
Browse files Browse the repository at this point in the history
# Conflicts:
#	FFXIVPlugin/XIVDeck.FFXIVPlugin.csproj
#	SDPlugin/package.json
  • Loading branch information
KazWolfe committed May 19, 2022
2 parents 8bccb41 + 9b89011 commit 6ca562f
Show file tree
Hide file tree
Showing 81 changed files with 3,345 additions and 422 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/crowdin-sync.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Synchronize Crowdin Changes

on:
workflow_dispatch:

jobs:
synchronize-with-crowdin:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Get Branch Name
shell: bash
run: echo "::set-output name=branch::${GITHUB_REF#refs/heads/}"
id: branch
- name: Update localization
uses: crowdin/[email protected]
with:
upload_translations: true
upload_sources: true
auto_approve_imported: true
import_eq_suggestions: true

download_translations: true
skip_untranslated_strings: true
skip_untranslated_files: true
export_only_approved: true
push_translations: true
commit_message: '[Crowdin] Synchronize Localization Changes'
create_pull_request: true
pull_request_title: '[Crowdin] Synchronize Localization Changes'
pull_request_body: 'Update localization with latest translations from crowdin'

crowdin_branch_name: ${{ steps.branch.outputs.branch }}
localization_branch_name: 'crowdin-${{ steps.branch.outputs.branch }}'
pull_request_base_branch_name: ${{ steps.branch.outputs.branch }}

config: 'crowdin.yml'

env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
CROWDIN_PROJECT_ID: ${{secrets.CROWDIN_PROJECT_ID}}
CROWDIN_PERSONAL_TOKEN: ${{secrets.CROWDIN_PERSONAL_TOKEN}}
26 changes: 26 additions & 0 deletions .github/workflows/crowdin-upload.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Upload to Crowdin

on:
push:
branches: [ localization ]

jobs:
crowdin-upload:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Get Branch Name
shell: bash
run: echo "::set-output name=branch::${GITHUB_REF#refs/heads/}"
id: branch
- name: Crowdin Action
uses: crowdin/[email protected]
with:
upload_sources: true
upload_translations: true
download_translations: false
crowdin_branch_name: ${{ steps.branch.outputs.branch }}
env:
CROWDIN_PROJECT_ID: ${{secrets.CROWDIN_PROJECT_ID}}
CROWDIN_PERSONAL_TOKEN: ${{secrets.CROWDIN_PERSONAL_TOKEN}}
7 changes: 4 additions & 3 deletions FFXIVPlugin/ActionExecutor/FixedCommandStrategy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using Lumina.Excel;
using XIVDeck.FFXIVPlugin.Base;
using XIVDeck.FFXIVPlugin.Game;
using XIVDeck.FFXIVPlugin.Resources.Localization;
using XIVDeck.FFXIVPlugin.Utils;

namespace XIVDeck.FFXIVPlugin.ActionExecutor;
Expand Down Expand Up @@ -37,7 +38,7 @@ public List<ExecutableAction> GetAllowedItems() {
ExcelSheet<T> sheet = Injections.DataManager.Excel.GetSheet<T>()!;

if (sheet == null) {
throw new NullReferenceException($"A sheet of type {typeof(T).Name} does not exist.");
throw new NullReferenceException(string.Format(UIStrings.FixedCommandStrategy_SheetNotFoundError, typeof(T).Name));
}

foreach (var row in sheet) {
Expand Down Expand Up @@ -68,13 +69,13 @@ public List<ExecutableAction> GetAllowedItems() {

public void Execute(uint actionId, dynamic? options = null) {
if (this.GetIllegalActionIDs().Contains(actionId))
throw new ArgumentException($"The action with ID {actionId} is marked as illegal and cannot be used.");
throw new ArgumentException(string.Format(UIStrings.FixedCommandStrategy_IllegalActionError, actionId));

var action = GetActionById(actionId);

if (action == null) {
throw new ArgumentNullException(nameof(actionId),
$"An action of type {typeof(T)} with ID {actionId} does not exist.");
string.Format(UIStrings.FixedCommandStrategy_ActionNotFoundError, typeof(T), actionId));
}

var command = this.GetCommandToCallAction(action);
Expand Down
3 changes: 2 additions & 1 deletion FFXIVPlugin/ActionExecutor/Strategies/CollectionStrategy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using XIVDeck.FFXIVPlugin.Base;
using XIVDeck.FFXIVPlugin.Game;
using XIVDeck.FFXIVPlugin.Game.Sheets;
using XIVDeck.FFXIVPlugin.Resources.Localization;

namespace XIVDeck.FFXIVPlugin.ActionExecutor.Strategies;

Expand Down Expand Up @@ -53,7 +54,7 @@ public void Execute(uint actionId, dynamic? _) {
var mcguffin = GetMcGuffinById(actionId);

if (mcguffin == null) {
throw new ArgumentOutOfRangeException(nameof(actionId), $"No Collection with ID {actionId} exists.");
throw new ArgumentOutOfRangeException(nameof(actionId), string.Format(UIStrings.CollectionStrategy_CollectionNotFoundError, actionId));
}

TickScheduler.Schedule(delegate {
Expand Down
5 changes: 3 additions & 2 deletions FFXIVPlugin/ActionExecutor/Strategies/EmoteStrategy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using XIVDeck.FFXIVPlugin.Base;
using XIVDeck.FFXIVPlugin.Exceptions;
using XIVDeck.FFXIVPlugin.Game;
using XIVDeck.FFXIVPlugin.Resources.Localization;
using XIVDeck.FFXIVPlugin.Utils;

namespace XIVDeck.FFXIVPlugin.ActionExecutor.Strategies;
Expand Down Expand Up @@ -50,11 +51,11 @@ public void Execute(uint actionId, dynamic? _) {
var textCommand = emote.TextCommand.Value;

if (textCommand == null) {
throw new KeyNotFoundException($"The emote \"{emote.Name}\" does not have an associated text command.");
throw new KeyNotFoundException(string.Format(UIStrings.EmoteStrategy_EmoteDoesntHaveCommandError, emote.Name));
}

if (!GameStateCache.IsEmoteUnlocked(emote.RowId)) {
throw new ActionLockedException($"The emote \"{emote.Name}\" isn't unlocked and therefore can't be used.");
throw new ActionLockedException(string.Format(UIStrings.EmoteStrategy_EmoteLockedError, emote.Name));
}

PluginLog.Debug($"Would execute command: {textCommand.Command}");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using FFXIVClientStructs.FFXIV.Client.UI.Misc;
using XIVDeck.FFXIVPlugin.Game.Sheets;
using XIVDeck.FFXIVPlugin.Resources.Localization;

namespace XIVDeck.FFXIVPlugin.ActionExecutor.Strategies;

Expand All @@ -24,7 +25,7 @@ protected override string GetCommandToCallAction(ExtraCommand action) {
1 => "/grouppose",
2 => "/idlingcamera",
3 => "/alarm",
_ => throw new ArgumentException($"No command exists for Extra Command {action.Name}. REPORT THIS BUG!")
_ => throw new ArgumentException(string.Format(UIStrings.ExtraCommandStrategy_NoCommandError, action.Name))
};
}
}
3 changes: 2 additions & 1 deletion FFXIVPlugin/ActionExecutor/Strategies/GearsetStrategy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using Dalamud.Memory;
using FFXIVClientStructs.FFXIV.Client.UI.Misc;
using XIVDeck.FFXIVPlugin.Game;
using XIVDeck.FFXIVPlugin.Resources.Localization;
using XIVDeck.FFXIVPlugin.Utils;

namespace XIVDeck.FFXIVPlugin.ActionExecutor.Strategies;
Expand Down Expand Up @@ -55,7 +56,7 @@ public void Execute(uint actionSlot, dynamic? _) {
var gearset = GetGearsetBySlot(actionSlot);

if (gearset == null)
throw new ArgumentException($"No gearset exists in slot number {actionSlot}.");
throw new ArgumentException(string.Format(UIStrings.GearsetStrategy_GearsetNotFoundError, actionSlot));

var command = $"/gearset change {gearset.Value.Slot + 1}";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using XIVDeck.FFXIVPlugin.Base;
using XIVDeck.FFXIVPlugin.Exceptions;
using XIVDeck.FFXIVPlugin.Game;
using XIVDeck.FFXIVPlugin.Resources.Localization;
using XIVDeck.FFXIVPlugin.Utils;

namespace XIVDeck.FFXIVPlugin.ActionExecutor.Strategies;
Expand Down Expand Up @@ -70,16 +71,16 @@ public unsafe void Execute(uint actionId, dynamic? _) {
var action = GetActionById(actionId);

if (action == null) {
throw new ArgumentOutOfRangeException(nameof(actionId), $"No action with ID {actionId} exists.");
throw new ActionNotFoundException(HotbarSlotType.GeneralAction, actionId);
}

if (this.GetIllegalActionIDs().Contains(actionId)) {
throw new ArgumentOutOfRangeException(nameof(actionId),
$"The action \"{action.Name}\" (ID {actionId}) is marked as illegal and cannot be used.");
string.Format(UIStrings.GeneralActionStrategy_ActionIllegalError, action.Name, actionId));
}

if (action.UnlockLink != 0 && !UIState.Instance()->IsUnlockLinkUnlocked(action.UnlockLink)) {
throw new ActionLockedException($"The action \"{action.Name}\" is not yet unlocked.");
throw new ActionLockedException(string.Format(UIStrings.GeneralActionStrategy_ActionLockedError, action.Name));
}

if (actionId == 12 && UIState.Instance()->IsUnlockLinkUnlocked(12)) {
Expand Down
7 changes: 4 additions & 3 deletions FFXIVPlugin/ActionExecutor/Strategies/InstrumentStrategy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using XIVDeck.FFXIVPlugin.Base;
using XIVDeck.FFXIVPlugin.Exceptions;
using XIVDeck.FFXIVPlugin.Game;
using XIVDeck.FFXIVPlugin.Resources.Localization;

namespace XIVDeck.FFXIVPlugin.ActionExecutor.Strategies;

Expand Down Expand Up @@ -49,17 +50,17 @@ public void Execute(uint actionId, dynamic? _) {
// about this.

if (!this.IsPerformUnlocked()) {
throw new ActionLockedException("Performance mode hasn't yet been unlocked.");
throw new ActionLockedException(UIStrings.InstrumentStrategy_PerformanceLockedError);
}

if (Injections.Condition[ConditionFlag.Performing]) {
throw new IllegalGameStateException("Cannot switch instruments while actively in Perform mode.");
throw new IllegalGameStateException(UIStrings.InstrumentStrategy_CurrentlyPerformingError);
}

var instrument = GetActionById(actionId);

if (instrument == null) {
throw new ArgumentOutOfRangeException(nameof(actionId), $"No instrument with ID {actionId} exists.");
throw new ArgumentOutOfRangeException(nameof(actionId), string.Format(UIStrings.InstrumentStrategy_InstrumentNotFoundError, actionId));
}

TickScheduler.Schedule(delegate {
Expand Down
3 changes: 2 additions & 1 deletion FFXIVPlugin/ActionExecutor/Strategies/MacroStrategy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using FFXIVClientStructs.FFXIV.Client.UI.Shell;
using XIVDeck.FFXIVPlugin.Exceptions;
using XIVDeck.FFXIVPlugin.Game;
using XIVDeck.FFXIVPlugin.Resources.Localization;

namespace XIVDeck.FFXIVPlugin.ActionExecutor.Strategies;

Expand Down Expand Up @@ -44,7 +45,7 @@ public unsafe void Execute(uint actionId, dynamic? _) {

// Safety check to make sure we aren't triggering an empty macro
if (RaptureMacroModule.Instance->GetLineCount(macro) == 0) {
throw new IllegalGameStateException("The specified macro is empty and cannot be used.");
throw new IllegalGameStateException(UIStrings.MacroStrategy_MacroEmptyError);
}

PluginLog.Debug($"Would execute macro number {macroNumber}");
Expand Down
3 changes: 2 additions & 1 deletion FFXIVPlugin/ActionExecutor/Strategies/MainCommandStrategy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using Lumina.Excel.GeneratedSheets;
using XIVDeck.FFXIVPlugin.Base;
using XIVDeck.FFXIVPlugin.Game;
using XIVDeck.FFXIVPlugin.Resources.Localization;

namespace XIVDeck.FFXIVPlugin.ActionExecutor.Strategies;

Expand Down Expand Up @@ -39,7 +40,7 @@ public MainCommandStrategy() {

public unsafe void Execute(uint actionId, dynamic? _) {
if (this._mainCommandCache.All(command => actionId != command.RowId))
throw new InvalidOperationException($"Main command action ID {actionId} is not valid.");
throw new InvalidOperationException(string.Format(UIStrings.MainCommandStrategy_ActionInvalidError, actionId));

TickScheduler.Schedule(delegate {
Framework.Instance()->GetUiModule()->ExecuteMainCommand(actionId);
Expand Down
5 changes: 3 additions & 2 deletions FFXIVPlugin/ActionExecutor/Strategies/MinionStrategy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using XIVDeck.FFXIVPlugin.Base;
using XIVDeck.FFXIVPlugin.Exceptions;
using XIVDeck.FFXIVPlugin.Game;
using XIVDeck.FFXIVPlugin.Resources.Localization;
using XIVDeck.FFXIVPlugin.Utils;

namespace XIVDeck.FFXIVPlugin.ActionExecutor.Strategies;
Expand Down Expand Up @@ -42,11 +43,11 @@ public void Execute(uint actionId, dynamic? _) {
var minion = GetMinionById(actionId);

if (minion == null) {
throw new ArgumentNullException(nameof(actionId), $"No minion with ID {actionId} exists.");
throw new ArgumentNullException(nameof(actionId), string.Format(UIStrings.MinionStrategy_MinionNotFoundError, actionId));
}

if (!GameStateCache.IsMinionUnlocked(actionId)) {
throw new ActionLockedException($"The minion \"{minion.Singular}\" isn't unlocked and therefore can't be used.");
throw new ActionLockedException(string.Format(UIStrings.MinionStrategy_MinionLockedError, minion.Singular));
}

var command = $"/minion \"{minion.Singular}\"";
Expand Down
5 changes: 3 additions & 2 deletions FFXIVPlugin/ActionExecutor/Strategies/MountStrategy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using XIVDeck.FFXIVPlugin.Base;
using XIVDeck.FFXIVPlugin.Exceptions;
using XIVDeck.FFXIVPlugin.Game;
using XIVDeck.FFXIVPlugin.Resources.Localization;
using XIVDeck.FFXIVPlugin.Utils;

namespace XIVDeck.FFXIVPlugin.ActionExecutor.Strategies;
Expand Down Expand Up @@ -38,11 +39,11 @@ public void Execute(uint actionId, dynamic? _) {
Mount? mount = GetMountById(actionId);

if (mount == null) {
throw new ArgumentNullException(nameof(actionId), $"No mount with ID {actionId} exists.");
throw new ArgumentNullException(nameof(actionId), string.Format(UIStrings.MountStrategy_MountNotFoundError, actionId));
}

if (!_gameStateCache.IsMountUnlocked(actionId)) {
throw new ActionLockedException($"The mount \"{mount.Singular}\" isn't unlocked and therefore can't be used.");
throw new ActionLockedException(string.Format(UIStrings.MountStrategy_MountLockedError, mount.Singular));
}

String command = $"/mount \"{mount.Singular}\"";
Expand Down
3 changes: 2 additions & 1 deletion FFXIVPlugin/ActionExecutor/Strategies/OrnamentStrategy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using XIVDeck.FFXIVPlugin.Base;
using XIVDeck.FFXIVPlugin.Exceptions;
using XIVDeck.FFXIVPlugin.Game;
using XIVDeck.FFXIVPlugin.Resources.Localization;
using XIVDeck.FFXIVPlugin.Utils;

namespace XIVDeck.FFXIVPlugin.ActionExecutor.Strategies;
Expand Down Expand Up @@ -46,7 +47,7 @@ public void Execute(uint actionId, dynamic? _) {
}

if (!GameStateCache.IsOrnamentUnlocked(actionId)) {
throw new ActionLockedException($"The fashion accessory \"{ornament.Singular}\" isn't unlocked and therefore can't be used.");
throw new ActionLockedException(string.Format(UIStrings.OrnamentStrategy_OrnamentLockedError, ornament.Singular));
}

var command = $"/fashion \"{ornament.Singular}\"";
Expand Down
13 changes: 6 additions & 7 deletions FFXIVPlugin/Constants.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
namespace XIVDeck.FFXIVPlugin {
public static class Constants {
public const string PluginName = "XIVDeck Game Plugin";
public const string MinimumSDPluginVersion = "0.1.0";
public const string GithubUrl = "https://github.com/KazWolfe/XIVDeck";
}
}
namespace XIVDeck.FFXIVPlugin;

public static class Constants {
public const string MinimumSDPluginVersion = "0.1.0";
public const string GithubUrl = "https://github.com/KazWolfe/XIVDeck";
}
7 changes: 4 additions & 3 deletions FFXIVPlugin/Exceptions/GameExceptions.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using FFXIVClientStructs.FFXIV.Client.UI.Misc;
using XIVDeck.FFXIVPlugin.Resources.Localization;

namespace XIVDeck.FFXIVPlugin.Exceptions;

Expand All @@ -11,17 +12,17 @@ public IllegalGameStateException(string message) :

public class PlayerNotLoggedInException : IllegalGameStateException {
public PlayerNotLoggedInException() :
base("A player is not logged in to the game.") { }
base(UIStrings.Exceptions_PlayerNotLoggedIn) { }
}
public class ActionLockedException : IllegalGameStateException {
public ActionLockedException(HotbarSlotType type, uint actionId) :
base($"The {type} ID {actionId} is has not been unlocked and cannot be used.") { }
base(string.Format(UIStrings.Exceptions_ActionLocked, type, actionId)) { }

public ActionLockedException(string message) :
base(message) { }
}

public class ActionNotFoundException : ArgumentException {
public ActionNotFoundException(HotbarSlotType actionType, uint actionId) :
base($"No {actionType} with ID {actionId} was found") { }
base(string.Format(UIStrings.Exceptions_ActionNotFound, actionType, actionId)) { }
}
2 changes: 1 addition & 1 deletion FFXIVPlugin/Game/HotbarWatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ private unsafe void OnGameUpdate(Framework framework) {
GetRaptureHotbarModule();

var hotbarUpdated = false;

for (var hotbarId = 0; hotbarId < 17; hotbarId++) {
var hotbar = hotbarModule->HotBar[hotbarId];

Expand Down
2 changes: 1 addition & 1 deletion FFXIVPlugin/Game/IconManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ private void LoadIconTexture(int iconId, bool hq = false) {
ClientLanguage.German => "de/",
ClientLanguage.French => "fr/",
_ => throw new ArgumentOutOfRangeException(nameof(iconLanguage),
"Unknown Language: " + Injections.DataManager.Language)
@"Unknown Language: " + Injections.DataManager.Language)
};

return this.GetIcon(language, iconId, hq, highres);
Expand Down
Loading

0 comments on commit 6ca562f

Please sign in to comment.