Changes

Jump to navigation Jump to search
m
Text replacement - "tt>" to "samp>"
Line 7: Line 7:  
==Add a custom language==
 
==Add a custom language==
 
===Data format===
 
===Data format===
You can add custom languages by editing the <tt>Data/AdditionalLanguages</tt> asset. Each entry consists of an object with these fields:
+
You can add custom languages by editing the <samp>Data/AdditionalLanguages</samp> asset. Each entry consists of an object with these fields:
    
{| class="wikitable"
 
{| class="wikitable"
Line 14: Line 14:  
! description
 
! description
 
|-
 
|-
| <tt>ID</tt>
+
| <samp>ID</samp>
 
| A unique identifier for your language. This isn't shown in-game. The recommended format is <code>&lt;your name&gt;.&lt;mod name&gt;</code>, with no spaces or special characters.
 
| A unique identifier for your language. This isn't shown in-game. The recommended format is <code>&lt;your name&gt;.&lt;mod name&gt;</code>, with no spaces or special characters.
 
|-
 
|-
| <tt>LanguageCode</tt>
+
| <samp>LanguageCode</samp>
| The language code for this localization. This should ideally be an [[wikipedia:List of ISO 639-1 codes|ISO 639-1 code]], with only letters and hyphens. You should avoid commas for compatibility with Content Patcher packs checking the <tt><nowiki>{{Language}}</nowiki></tt> token.
+
| The language code for this localization. This should ideally be an [[wikipedia:List of ISO 639-1 codes|ISO 639-1 code]], with only letters and hyphens. You should avoid commas for compatibility with Content Patcher packs checking the <samp><nowiki>{{Language}}</nowiki></samp> token.
 
|-
 
|-
| <tt>ButtonTexture</tt>
+
| <samp>ButtonTexture</samp>
 
| The asset name for a 174x78 pixel texture containing the button of the language for language selection menu. The top half of the sprite is the default state, while the bottom half is the hover state.
 
| The asset name for a 174x78 pixel texture containing the button of the language for language selection menu. The top half of the sprite is the default state, while the bottom half is the hover state.
 
|-
 
|-
| <tt>TimeFormat</tt>
+
| <samp>TimeFormat</samp>
 
| A string which describes the in-game time format, with tokens replaced by in-game values. For example, <code>[HOURS_12]:[MINUTES] [AM_PM]</code> would show <code>12:00 PM</code> at noon.
 
| A string which describes the in-game time format, with tokens replaced by in-game values. For example, <code>[HOURS_12]:[MINUTES] [AM_PM]</code> would show <code>12:00 PM</code> at noon.
   Line 34: Line 34:  
* <code>[AM_PM]</code>: the localized text for "am" or "pm" (taken from <code>Strings\\StringsFromCSFiles:DayTimeMoneyBox.cs.10370</code> and <code>DayTimeMoneyBox.cs.10371</code> respectively). The game shows "pm" between noon and 11:59pm inclusively; it shows "am" otherwise.
 
* <code>[AM_PM]</code>: the localized text for "am" or "pm" (taken from <code>Strings\\StringsFromCSFiles:DayTimeMoneyBox.cs.10370</code> and <code>DayTimeMoneyBox.cs.10371</code> respectively). The game shows "pm" between noon and 11:59pm inclusively; it shows "am" otherwise.
 
|-
 
|-
| <tt>ClockTimeFormat</tt>
+
| <samp>ClockTimeFormat</samp>
| A string which describes the in-game time format. Equivalent to <tt>TimeFormat</tt>, but used for the in-game clock.
+
| A string which describes the in-game time format. Equivalent to <samp>TimeFormat</samp>, but used for the in-game clock.
 
|-
 
|-
| <tt>ClockDateFormat</tt>
+
| <samp>ClockDateFormat</samp>
 
| A string which describes the in-game date format as shown in the in-game clock, with tokens replaced by in-game values. For example, <code>[DAY_OF_WEEK]. [DAY_OF_MONTH]</code> would show <code>Mon. 1</code>.
 
| A string which describes the in-game date format as shown in the in-game clock, with tokens replaced by in-game values. For example, <code>[DAY_OF_WEEK]. [DAY_OF_MONTH]</code> would show <code>Mon. 1</code>.
    
The valid tokens are:
 
The valid tokens are:
* <code>[DAY_OF_WEEK]</code>: the abbreviated day of week as returned by <code>Game1.shortDayDisplayNameFromDayOfSeason</code> (like <tt>Mon</tt> for Monday).
+
* <code>[DAY_OF_WEEK]</code>: the abbreviated day of week as returned by <code>Game1.shortDayDisplayNameFromDayOfSeason</code> (like <samp>Mon</samp> for Monday).
 
* <code>[DAY_OF_MONTH]</code>: the numerical day of the month.
 
* <code>[DAY_OF_MONTH]</code>: the numerical day of the month.
 
|-
 
|-
| <tt>UseLatinFont</tt>
+
| <samp>UseLatinFont</samp>
| Whether the language uses the game's default fonts. If set to <tt>false</tt>, you must set the <tt>FontFile</tt> field.
+
| Whether the language uses the game's default fonts. If set to <samp>false</samp>, you must set the <samp>FontFile</samp> field.
 
|-
 
|-
| <tt>FontFile</tt>
+
| <samp>FontFile</samp>
| ''(optional)'' The asset name for the font file to use (if <tt>UseLatinFont</tt> is <tt>false</tt>). See [[#Custom font|''custom font'']] below.
+
| ''(optional)'' The asset name for the font file to use (if <samp>UseLatinFont</samp> is <samp>false</samp>). See [[#Custom font|''custom font'']] below.
 
|-
 
|-
| <tt>FontPixelZoom</tt>
+
| <samp>FontPixelZoom</samp>
 
| ''(optional)'' A factor by while to multiply the font size.
 
| ''(optional)'' A factor by while to multiply the font size.
 
|-
 
|-
| <tt>FontApplyYOffset</tt>
+
| <samp>FontApplyYOffset</samp>
| ''(optional)'' Whether to shift the font up by four pixels (multiplied by the <tt>FontPixelZoom</tt>), to better align languages with larger characters like Chinese and Japanese.
+
| ''(optional)'' Whether to shift the font up by four pixels (multiplied by the <samp>FontPixelZoom</samp>), to better align languages with larger characters like Chinese and Japanese.
 
|-
 
|-
| <tt>NumberComma</tt>
+
| <samp>NumberComma</samp>
 
| ''(optional)'' The string to use as the thousands separator (e.g. <code>","</code> for <code>5,000,000</code>). Defaults to a comma.
 
| ''(optional)'' The string to use as the thousands separator (e.g. <code>","</code> for <code>5,000,000</code>). Defaults to a comma.
 
|-
 
|-
| <tt>SmallFontLineSpacing</tt>
+
| <samp>SmallFontLineSpacing</samp>
| ''(optional)'' The line spacing value used by <tt>smallFont</tt>. Defaults to 26.
+
| ''(optional)'' The line spacing value used by <samp>smallFont</samp>. Defaults to 26.
 
|-
 
|-
| <tt>UseGenderedCharacterTranslations</tt>
+
| <samp>UseGenderedCharacterTranslations</samp>
 
| ''(optional)'' Whether the social tab and gift log will use gender-specific translations (like the vanilla Portuguese language). Defaults to false.
 
| ''(optional)'' Whether the social tab and gift log will use gender-specific translations (like the vanilla Portuguese language). Defaults to false.
   −
Specifically, this affects the <tt>Strings\StringsFromCSFiles:SocialPage.cs.11635</tt> translation ("''(Single)''"). When enabled, it can contain male and female translations separated by <code>/</code>, like the vanilla Portuguese translation: "''(solteiro)/(solteira)''".
+
Specifically, this affects the <samp>Strings\StringsFromCSFiles:SocialPage.cs.11635</samp> translation ("''(Single)''"). When enabled, it can contain male and female translations separated by <code>/</code>, like the vanilla Portuguese translation: "''(solteiro)/(solteira)''".
 
|}
 
|}
    
===Example===
 
===Example===
This Content Patcher pack would add Esperanto to the game. '''You should change <tt>Pathoschild.Esperanto</tt> to your mod's actual ID.'''
+
This Content Patcher pack would add Esperanto to the game. '''You should change <samp>Pathoschild.Esperanto</samp> to your mod's actual ID.'''
 
{{#tag:syntaxhighlight|
 
{{#tag:syntaxhighlight|
 
{
 
{
Line 117: Line 117:     
==Custom font==
 
==Custom font==
If you set <tt>UseLatinFont: false</tt> in the language data, you can provide your own Bitmap font with the <tt>FontFile</tt> field. This lets you map arbitrary Unicode characters to sprites in your font texture. You can [[Modding:Editing XNB files#Unpack game files|unpack your game's <tt>Content</tt> folder]] and look at the Chinese, Japanese, Korean, and Russian fonts in the <tt>Fonts</tt> folder for some examples.
+
If you set <samp>UseLatinFont: false</samp> in the language data, you can provide your own Bitmap font with the <samp>FontFile</samp> field. This lets you map arbitrary Unicode characters to sprites in your font texture. You can [[Modding:Editing XNB files#Unpack game files|unpack your game's <samp>Content</samp> folder]] and look at the Chinese, Japanese, Korean, and Russian fonts in the <samp>Fonts</samp> folder for some examples.
   −
For example, here's the <tt>Content/Fonts/Japanese.fnt</tt> file (with most of the characters stripped out for brevity):
+
For example, here's the <samp>Content/Fonts/Japanese.fnt</samp> file (with most of the characters stripped out for brevity):
    
<syntaxhighlight lang="xml">
 
<syntaxhighlight lang="xml">
Line 145: Line 145:  
! description
 
! description
 
|-
 
|-
| <tt>info</tt>
+
| <samp>info</samp>
 
| Describes the font itself: the name, TrueType size, padding and spacing, etc.
 
| Describes the font itself: the name, TrueType size, padding and spacing, etc.
 
|-
 
|-
| <tt>common</tt>
+
| <samp>common</samp>
 
| Provides common info which applies to all of the characters, like the line height.
 
| Provides common info which applies to all of the characters, like the line height.
 
|-
 
|-
| <tt>pages</tt>
+
| <samp>pages</samp>
| Lists the sprite textures that are part of the font. In the above example, the Japanese character sprites are split into two images: <tt>Japanese_0.png</tt> and <tt>Japanese_1.png</tt>. Each character in <tt>chars</tt> specifies which page it's on.
+
| Lists the sprite textures that are part of the font. In the above example, the Japanese character sprites are split into two images: <samp>Japanese_0.png</samp> and <samp>Japanese_1.png</samp>. Each character in <samp>chars</samp> specifies which page it's on.
 
|-
 
|-
| <tt>chars</tt>
+
| <samp>chars</samp>
| Maps each Unicode character you'll use in-game to the sprite font. The example above defines one character with these <tt>char</tt> fields:
+
| Maps each Unicode character you'll use in-game to the sprite font. The example above defines one character with these <samp>char</samp> fields:
    
{| class="wikitable"
 
{| class="wikitable"
Line 162: Line 162:  
! explanation
 
! explanation
 
|-
 
|-
| <tt>id</tt>
+
| <samp>id</samp>
 
| The decimal Unicode ID for the character (e.g. 37347 in the example above is 釣). You can search characters in [https://www.unicodepedia.com/unicode/cjk-unified-ideographs/91e3/cjk-unified-ideograph-91e3/ Unicodepedia] to find their Unicode IDs.
 
| The decimal Unicode ID for the character (e.g. 37347 in the example above is 釣). You can search characters in [https://www.unicodepedia.com/unicode/cjk-unified-ideographs/91e3/cjk-unified-ideograph-91e3/ Unicodepedia] to find their Unicode IDs.
 
|-
 
|-
| <tt>x</tt><br /><tt>y</tt><br /><tt>width</tt><br /><tt>height</tt>
+
| <samp>x</samp><br /><samp>y</samp><br /><samp>width</samp><br /><samp>height</samp>
 
| The top-left position and size of the character sprite in the page image, measured in pixels.
 
| The top-left position and size of the character sprite in the page image, measured in pixels.
 
|-
 
|-
| <tt>xoffset</tt><br /><tt>yoffset</tt>
+
| <samp>xoffset</samp><br /><samp>yoffset</samp>
 
| A pixel offset to apply to the character when it's drawn to the screen.
 
| A pixel offset to apply to the character when it's drawn to the screen.
 
|-
 
|-
| <tt>xadvance</tt>
+
| <samp>xadvance</samp>
 
| When drawing multiple characters to the screen, how many pixels drawing this character should advance the cursor.
 
| When drawing multiple characters to the screen, how many pixels drawing this character should advance the cursor.
 
|-
 
|-
| <tt>page</tt>
+
| <samp>page</samp>
| The ID of the page image which contains the sprite, as defined in the <tt>pages</tt> field.
+
| The ID of the page image which contains the sprite, as defined in the <samp>pages</samp> field.
 
|-
 
|-
| <tt>chnl</tt>
+
| <samp>chnl</samp>
| The color channel for which the sprite has data. (This is always <tt>15</tt> for all channels in Stardew Valley's current fonts.)
+
| The color channel for which the sprite has data. (This is always <samp>15</samp> for all channels in Stardew Valley's current fonts.)
 
|}
 
|}
 
|}
 
|}
107,014

edits

Navigation menu