It is currently March 28th, 2024, 2:40 pm

How to display day and month in Japanese?

Get help with creating, editing & fixing problems with skins
Post Reply
poytaa
Posts: 3
Joined: May 13th, 2018, 9:20 am

How to display day and month in Japanese?

Post by poytaa »

I'm currently using the LIM!T skin for my date and I'm wanting to change the display of the month from English to Japanese, eg. "May" to "5月" and "Sunday" to "日曜日" I'm a bit lost lol.

Here's the code.

Thanks!

Code: Select all

[Rainmeter]
Update=1000

[Variables]
@include1=#@#limvar.ini
; main string size
size=100

;---Styles---
@include2=#@#styles.ini

;---Measures---

[mTime]
Measure=Time
[mMonth]
Measure=Time
Format=%m
[mMonthName]
Measure=Time
Format=%b
[mDate]
Measure=Time
Format=%d
MinValue=0
MaxValue=( ([mMonth]=2) ? 28 : ( ( ([mMonth]=4) || ([mMonth]=6) || ([mMonth]=9) || ([mMonth]=11) ) ? 30 : 31 ) )
DynamicVariables=1
[mDayOfYear]
Measure=Time
Format=%j
MinValue=0
MaxValue=366
[mYear]
Measure=Time
Format=%Y

; Calculations
[cDateH]
Measure=Calc
Formula=(FRAC(mTime/86400)+#offset#)*#lineheight#*#size#
[cMonthH]
Measure=Calc
Formula=(mDate/[mDate:MaxValue]+#offset#)*#lineheight#*#size#*0.45
DynamicVariables=1
[cYearH]
Measure=Calc
Formula=(mDayOfYear/366+#offset#)*#lineheight#*#size#*0.3
DynamicVariables=1

;---Meters---

[MonthBG]
MeasureName=mMonthName
Meter=String
MeterStyle=sText | sBG
X=#size#
Y=(0.8*#size#)
FontSize=(#size#*0.45)
StringAlign=CenterBottom
StringStyle=BOLD
[MonthFill]
MeasureName=mMonthName
Meter=String
MeterStyle=sText | sFill
W=(2*#size#)
H=[cMonthH:]
FontSize=(#size#*0.45)
StringAlign=CenterBottom
StringStyle=BOLD
FontColor=#color1#

[DateBG]
MeasureName=mDate
Meter=String
MeterStyle=sText | sBG
X=0r
Y=(1.4*#size#)r
StringAlign=CenterBottom
[DateFill]
MeasureName=mDate
Meter=String
MeterStyle=sText | sFill
W=(2*#size#)
H=[cDateH:]
StringAlign=CenterBottom
FontColor=#color2#

[YearBG]
MeasureName=mYear
Meter=String
MeterStyle=sText | sBG
X=0r
Y=0r
FontSize=(#size#*0.3)
StringAlign=CenterBottom
StringStyle=BOLD
[YearFill]
MeasureName=mYear
Meter=String
MeterStyle=sText | sFill
W=(2*#size#)
H=[cYearH:]
FontSize=(#size#*0.3)
StringAlign=CenterBottom
StringStyle=BOLD
FontColor=#color3#
Last edited by poytaa on May 13th, 2018, 11:05 am, edited 1 time in total.
mak_kawa
Posts: 908
Joined: December 30th, 2015, 9:47 am

Re: How to display day and month in Japanese?

Post by mak_kawa »

Maybe you can use "Substitute=" expression for this puropose, I think.

Code: Select all

[mMonthName]
Measure=Time
Format=%b
Substitute="Jan":"1月","Feb":"2月","Mar":"3月","Apr":"4月","May":"5月","Jun":"6月","Jul":"7月","Aug":"8月","Sep":"9月","Oct":"10月","Nov":"11月","Dec":"12月"
And I can't find a measure that gets name of the day of week in your code, but for example...

Code: Select all

[mDayWeekName]
Measure=Time
Format=%A
Substitute="Monday":"月曜日","Tuesday":"火曜日","Wednesday":"水曜日","Thursday":"木曜日","Friday":"金曜日","Saturday":"土曜日","Sunday":"日曜日"
poytaa
Posts: 3
Joined: May 13th, 2018, 9:20 am

Re: How to display day and month in Japanese?

Post by poytaa »

Thanks heaps! The Month names seem to be functioning properly, but the Japanese characters are displaying as ?'s. Would you happen to know how to make it display properly?
mak_kawa
Posts: 908
Joined: December 30th, 2015, 9:47 am

Re: How to display day and month in Japanese?

Post by mak_kawa »

How is the definition of "FontFace=" in the sText section described in #@#styles.ini?
poytaa
Posts: 3
Joined: May 13th, 2018, 9:20 am

Re: How to display day and month in Japanese?

Post by poytaa »

mak_kawa wrote:How is the definition of "FontFace=" in the sText section described in #@#styles.ini?

Code: Select all

[sText]
FontFace=#fname#
FontSize=#size#
StringEffect=SHADOW
FontEffectColor=#shadow#
StringCase=UPPER
StringAlign=LeftBottom
AntiAlias=1

[sBG]
FontColor=#bgcolor#

[sFill]
X=0r
Y=0r
StringEffect=NONE
ClipString=1
DynamicVariables=1
mak_kawa
Posts: 908
Joined: December 30th, 2015, 9:47 am

Re: How to display day and month in Japanese?

Post by mak_kawa »

And the value of a variable "fname"?

Or... how is the encoding of your ini file, shift-JIS or UTF-16/8?
User avatar
balala
Rainmeter Sage
Posts: 16109
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: How to display day and month in Japanese?

Post by balala »

poytaa wrote:I'm wanting to change the display of the month from English to Japanese, eg. "May" to "5月" and "Sunday" to "日曜日" I'm a bit lost lol.
As an answer to the original question, I'd say that instead of applying a substitution, I'd add a FormatLocale=ja-JP option to the Time measures of the code (eg the [mMonthName] measure, which returns the name of the month). This option "translates" the name of the month to the appropriate language.
Post Reply