summaryrefslogtreecommitdiff
path: root/src/SMAPI/Events/LocaleChangedEventArgs.cs
blob: 09d3f6e505a0dda2032809c1630c0620212273bc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
using System;
using LanguageCode = StardewValley.LocalizedContentManager.LanguageCode;

namespace StardewModdingAPI.Events
{
    /// <summary>Event arguments for an <see cref="IContentEvents.LocaleChanged"/> event.</summary>
    public class LocaleChangedEventArgs : EventArgs
    {
        /*********
        ** Accessors
        *********/
        /// <summary>The previous language enum value.</summary>
        /// <remarks>For a custom language, this is always <see cref="LanguageCode.mod"/>.</remarks>
        public LanguageCode OldLanguage { get; }

        /// <summary>The previous locale code.</summary>
        /// <remarks>This is the locale code as it appears in asset names, like <c>fr-FR</c> in <c>Maps/springobjects.fr-FR</c>. The locale code for English is an empty string.</remarks>
        public string OldLocale { get; }

        /// <summary>The new language enum value.</summary>
        /// <remarks><inheritdoc cref="OldLanguage" select="remarks" /></remarks>
        public LanguageCode NewLanguage { get; }

        /// <summary>The new locale code.</summary>
        /// <remarks><inheritdoc cref="OldLocale" select="remarks" /></remarks>
        public string NewLocale { get; }


        /*********
        ** Public methods
        *********/
        /// <summary>Construct an instance.</summary>
        /// <param name="oldLanguage">The previous language enum value.</param>
        /// <param name="oldLocale">The previous locale code.</param>
        /// <param name="newLanguage">The new language enum value.</param>
        /// <param name="newLocale">The new locale code.</param>
        internal LocaleChangedEventArgs(LanguageCode oldLanguage, string oldLocale, LanguageCode newLanguage, string newLocale)
        {
            this.OldLanguage = oldLanguage;
            this.OldLocale = oldLocale;
            this.NewLanguage = newLanguage;
            this.NewLocale = newLocale;
        }
    }
}