Page 1 of 1

How to display day and month in Japanese?

Posted: May 13th, 2018, 9:24 am
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#

Re: How to display day and month in Japanese?

Posted: May 13th, 2018, 10:19 am
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":"日曜日"

Re: How to display day and month in Japanese?

Posted: May 13th, 2018, 10:32 am
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?

Re: How to display day and month in Japanese?

Posted: May 13th, 2018, 10:57 am
by mak_kawa
How is the definition of "FontFace=" in the sText section described in #@#styles.ini?

Re: How to display day and month in Japanese?

Posted: May 13th, 2018, 11:05 am
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

Re: How to display day and month in Japanese?

Posted: May 13th, 2018, 11:29 am
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?

Re: How to display day and month in Japanese?

Posted: May 13th, 2018, 11:56 am
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.