Skip to content

Commit

Permalink
Merge pull request #2282 from andy840119/rename-from-language-to-tran…
Browse files Browse the repository at this point in the history
…slation

Rename from "language" to "translation" in some classes.
  • Loading branch information
andy840119 authored Sep 13, 2024
2 parents d17803d + 7c94f24 commit cddba45
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

namespace osu.Game.Rulesets.Karaoke.Tests.Editor.ChangeHandlers.Beatmaps;

public partial class BeatmapLanguagesChangeHandlerTest : BaseChangeHandlerTest<BeatmapLanguagesChangeHandler>
public partial class BeatmapTranslationsChangeHandlerTest : BaseChangeHandlerTest<BeatmapTranslationsChangeHandler>
{
[Test]
public void TestAdd()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

namespace osu.Game.Rulesets.Karaoke.Edit.ChangeHandlers.Beatmaps;

public partial class BeatmapLanguagesChangeHandler : BeatmapListPropertyChangeHandler<CultureInfo>, IBeatmapLanguagesChangeHandler
public partial class BeatmapTranslationsChangeHandler : BeatmapListPropertyChangeHandler<CultureInfo>, IBeatmapTranslationsChangeHandler
{
public IBindableList<CultureInfo> Languages => Items;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

namespace osu.Game.Rulesets.Karaoke.Edit.ChangeHandlers.Beatmaps;

public interface IBeatmapLanguagesChangeHandler
public interface IBeatmapTranslationsChangeHandler
{
IBindableList<CultureInfo> Languages { get; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@

namespace osu.Game.Rulesets.Karaoke.Screens.Edit.Beatmaps.Translations.Components;

public partial class CreateNewLanguageButton : IconButton, IHasPopover
public partial class CreateNewTranslationButton : IconButton, IHasPopover
{
[Resolved]
private IBeatmapLanguagesChangeHandler beatmapLanguagesChangeHandler { get; set; } = null!;
private IBeatmapTranslationsChangeHandler beatmapTranslationsChangeHandler { get; set; } = null!;

private readonly Bindable<CultureInfo?> currentLanguage = new();

public CreateNewLanguageButton()
public CreateNewTranslationButton()
{
Icon = FontAwesome.Solid.Plus;
Action = this.ShowPopover;
Expand All @@ -33,9 +33,9 @@ public CreateNewLanguageButton()
if (newLanguage == null)
return;
if (!beatmapLanguagesChangeHandler.Languages.Contains(newLanguage))
if (!beatmapTranslationsChangeHandler.Languages.Contains(newLanguage))
{
beatmapLanguagesChangeHandler.Add(newLanguage);
beatmapTranslationsChangeHandler.Add(newLanguage);
}
// after selected the language, should always hide the popover.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,33 +11,33 @@

namespace osu.Game.Rulesets.Karaoke.Screens.Edit.Beatmaps.Translations.Components;

public partial class RemoveLanguageButton : IconButton
public partial class RemoveTranslationButton : IconButton
{
[Resolved]
private IBeatmapLanguagesChangeHandler beatmapLanguagesChangeHandler { get; set; } = null!;
private IBeatmapTranslationsChangeHandler beatmapTranslationsChangeHandler { get; set; } = null!;

[Resolved]
private IDialogOverlay dialogOverlay { get; set; } = null!;

[Resolved]
private IBindable<CultureInfo> currentLanguage { get; set; } = null!;

public RemoveLanguageButton()
public RemoveTranslationButton()
{
Icon = FontAwesome.Solid.Trash;
Action = () =>
{
if (beatmapLanguagesChangeHandler.IsLanguageContainsTranslation(currentLanguage.Value))
if (beatmapTranslationsChangeHandler.IsLanguageContainsTranslation(currentLanguage.Value))
{
dialogOverlay.Push(new DeleteLanguagePopupDialog(currentLanguage.Value, isOk =>
{
if (isOk)
beatmapLanguagesChangeHandler.Remove(currentLanguage.Value);
beatmapTranslationsChangeHandler.Remove(currentLanguage.Value);
}));
}
else
{
beatmapLanguagesChangeHandler.Remove(currentLanguage.Value);
beatmapTranslationsChangeHandler.Remove(currentLanguage.Value);
}
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public partial class TranslationEditSection : Container, ITranslationInfoProvide
private readonly Bindable<CultureInfo?> currentLanguage = new();

[Resolved]
private IBeatmapLanguagesChangeHandler beatmapLanguagesChangeHandler { get; set; } = null!;
private IBeatmapTranslationsChangeHandler beatmapTranslationsChangeHandler { get; set; } = null!;

private readonly IBindableList<Lyric> bindableLyrics = new BindableList<Lyric>();

Expand Down Expand Up @@ -102,12 +102,12 @@ public TranslationEditSection()
RelativeSizeAxes = Axes.X,
},
Empty(),
new CreateNewLanguageButton
new CreateNewTranslationButton
{
Y = 5,
},
Empty(),
new RemoveLanguageButton
new RemoveTranslationButton
{
Y = 5,
},
Expand Down Expand Up @@ -190,7 +190,7 @@ public TranslationEditSection()
[BackgroundDependencyLoader]
private void load(ILyricsProvider lyricsProvider, OverlayColourProvider colourProvider)
{
languageDropdown.ItemSource = beatmapLanguagesChangeHandler.Languages;
languageDropdown.ItemSource = beatmapTranslationsChangeHandler.Languages;

bindableLyrics.BindTo(lyricsProvider.BindableLyrics);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@ namespace osu.Game.Rulesets.Karaoke.Screens.Edit.Beatmaps.Translations;

public partial class TranslationScreen : BeatmapEditorRoundedScreen
{
[Cached(typeof(IBeatmapLanguagesChangeHandler))]
private readonly BeatmapLanguagesChangeHandler beatmapLanguagesChangeHandler;
[Cached(typeof(IBeatmapTranslationsChangeHandler))]
private readonly BeatmapTranslationsChangeHandler beatmapTranslationsChangeHandler;

[Cached(typeof(ILyricTranslationChangeHandler))]
private readonly LyricTranslationChangeHandler lyricTranslationChangeHandler;

public TranslationScreen()
: base(KaraokeBeatmapEditorScreenMode.Translation)
{
AddInternal(beatmapLanguagesChangeHandler = new BeatmapLanguagesChangeHandler());
AddInternal(beatmapTranslationsChangeHandler = new BeatmapTranslationsChangeHandler());
AddInternal(lyricTranslationChangeHandler = new LyricTranslationChangeHandler());
}

Expand Down

0 comments on commit cddba45

Please sign in to comment.