Translating the main menu

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Message
Author
Fatimah
Regular
Posts: 86
Joined: Tue Mar 01, 2016 2:53 pm
Contact:

Translating the main menu

#1 Post by Fatimah » Sun Mar 20, 2016 2:25 pm

Hello!

I'm developing an Arabic game and I noticed something about the translation of the main menu. The load/save screen is not translated.
This caused a problem when I changed the default font to an Arabic font. Now the screen is filled with boxes "tofu".
I'm attaching a picture of the screen and also and a picture of the main menu (Which is fine).

I'm wondering what file has the translation so may be I can translate the load screen?

Thank you
Attachments
main.PNG
load.PNG

Fatimah
Regular
Posts: 86
Joined: Tue Mar 01, 2016 2:53 pm
Contact:

Re: Translating the main menu

#2 Post by Fatimah » Wed Mar 23, 2016 3:21 am

I looked through the screens.rpy & common.rpy files and both have the text translated. I'm now not sure where can I fix the problem.
Any help would be great!

Thanks

User avatar
Aoide
Regular
Posts: 31
Joined: Sat Jun 11, 2011 2:40 am
Contact:

Re: Translating the main menu

#3 Post by Aoide » Wed Mar 23, 2016 3:55 am

Is it possible that the original game uses a different font for those menu items?

philat
Eileen-Class Veteran
Posts: 1333
Joined: Wed Dec 04, 2013 12:33 pm
Contact:

Re: Translating the main menu

#4 Post by philat » Wed Mar 23, 2016 4:33 am

This is almost certainly a font issue. Check what font is used with the style inspector (shift+I).

Fatimah
Regular
Posts: 86
Joined: Tue Mar 01, 2016 2:53 pm
Contact:

Re: Translating the main menu

#5 Post by Fatimah » Wed Mar 23, 2016 4:35 am

The default font that Renpy uses is "DejaVuSans.ttf" and the screen looks like this if I use it.
However, it is still a problem. I'm doing an Arabic game and it will be strange having a screen with English choices.
Attachments
load-en.PNG

philat
Eileen-Class Veteran
Posts: 1333
Joined: Wed Dec 04, 2013 12:33 pm
Contact:

Re: Translating the main menu

#6 Post by philat » Wed Mar 23, 2016 4:48 am

I frankly have no idea why your chosen Arabic font apparently doesn't support Arabic numerals... but the default Arabic translations are under game/tl/None/screens.rpy.

Fatimah
Regular
Posts: 86
Joined: Tue Mar 01, 2016 2:53 pm
Contact:

Re: Translating the main menu

#7 Post by Fatimah » Wed Mar 23, 2016 4:59 am

philat wrote:I frankly have no idea why your chosen Arabic font apparently doesn't support Arabic numerals... but the default Arabic translations are under game/tl/None/screens.rpy.
I have tried several Arabic fonts (ttf & otf) and they all had the same problem. The only font that is working fine is Renpy default font.

Anyway, I found the translation. I have looked at this file before but somehow my eyes could not locate the lines that needs to be edited.

Thank you so much.

Fatimah
Regular
Posts: 86
Joined: Tue Mar 01, 2016 2:53 pm
Contact:

Re: Translating the main menu

#8 Post by Fatimah » Wed Mar 23, 2016 7:59 am

I just wanted to note that there are a couple of issues to consider to solve this problem:

First one:
some lines that contains the Arabic translation were commented so they need to be uncommented.

Second one:
The format in which Renpy name the save instance. Renpy uses "Month date time"
This causes a problem when changing the default font to any other Arabic font as they don't render the month's name correctly leaving the user with boxes all over the screen.

I tried to implement a simple code in which I translate the month's name to Arabic but this didn't work as the functions in the common file throw errors when you write any kind of statement inside them. I tried writing the code outside but this doesn't work either because I can't pass the variable inside the function.
I did not want to change the "00action file"

So does this mean that I'm restricted to only the default font in Renpy?

User avatar
PyTom
Ren'Py Creator
Posts: 15152
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: Translating the main menu

#9 Post by PyTom » Wed Mar 23, 2016 11:59 pm

First off, if you're going anywhere near Arabic, you need to add

Code: Select all

define config.rtl = True
To enable the Arabic glyph shaping.

To fix the problem with fonts, in screens.rpy, find the line:

Code: Select all

                    $ file_time = FileTime(i, empty=_("Empty Slot."))
and change it to:

Code: Select all

                    $ file_time = FileTime(i, format=_("{#file_time}%A, %B %d %Y, %H:%M"), empty=_("empty slot"))

In game/tl/common.rpy, there should be a number of translations for English weekdays and months. You should be able to translate them in, and adjust the formatting code above to your liking.

%A is the weekday.
%B is the month name.
%m is the month number.
%d is the day of the month.
%Y is the 4-digit common era year.
%H is the hour.
%M is the minute.
%S is the second.

%Y-%m-%d is the ISO date format code.

We don't support lunar calendars, but if you can write a python function that goes from a western-style date or a unix timestamp to a lunar calendar date, we can figure out the right way to add that to Ren'Py. (Also, is that actually unique into the future? http://www.fountainmagazine.com/Issue/d ... r-Calendar makes me think that it would be hard to write code that satisifies everyone.)
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
"Silly and fun things are important." - Elon Musk
Software > Drama • https://www.patreon.com/renpytom

Fatimah
Regular
Posts: 86
Joined: Tue Mar 01, 2016 2:53 pm
Contact:

Re: Translating the main menu

#10 Post by Fatimah » Thu Mar 24, 2016 3:57 am

First off, if you're going anywhere near Arabic, you need to add

Code:
define config.rtl = True


To enable the Arabic glyph shaping.
I already had this line in the options.rpy file.

To fix the problem with fonts, in screens.rpy, find the line:

Code:
$ file_time = FileTime(i, empty=_("Empty Slot."))


and change it to:

Code:
$ file_time = FileTime(i, format=_("{#file_time}%A, %B %d %Y, %H:%M"), empty=_("empty slot"))
I added this line and made a little change to it, so it displays "خانة فارغة" instead of "empty slot".
In game/tl/common.rpy, there should be a number of translations for English weekdays and months. You should be able to translate them in, and adjust the formatting code above to your liking.

%A is the weekday.
%B is the month name.
%m is the month number.
%d is the day of the month.
%Y is the 4-digit common era year.
%H is the hour.
%M is the minute.
%S is the second.
I'm sorry if I'm going to sound stupid but I didn't see anything in this file that has translation for weekdays and months. I'm going to post the file as a spoiler
but this is what I have and if you can point me toward the lines that I need to translate that will be great.

Code: Select all

    
translate arabic strings:

    # renpy/common/00action_file.rpy:124
    old "%b %d, %H:%M"
    new "%b %d, %H:%M"
        
    # renpy/common/00action_file.rpy:587
    old "Quick save complete."
    new "تم الحفظ السريع"


translate arabic strings:

    # renpy/common/00gallery.rpy:521
    old "Image [index] of [count] locked."
    new "يوجد عدد صور [index] من أصل [count] مقفل"

    # renpy/common/00gallery.rpy:539
    old "prev"
    new "السابق"

    # renpy/common/00gallery.rpy:540
    old "next"
    new "التالي"

    # renpy/common/00gallery.rpy:541
    old "slideshow"
    new "عرض الشرائح"

    # renpy/common/00gallery.rpy:542
    old "return"
    new "العودة"


translate arabic strings:

    # renpy/common/00gltest.rpy:50
    old "Graphics Acceleration"
    new "تسريع الرسومات"

    # renpy/common/00gltest.rpy:54
    old "Automatically Choose"
    new "إختيار اوتوماتيكي"

    # renpy/common/00gltest.rpy:59
    old "Force Angle/DirectX Renderer"
    new "فرض الزاوية/دايركت × ومحركاته"

    # renpy/common/00gltest.rpy:63
    old "Force OpenGL Renderer"
    new "فرض محرك OpenGL"

    # renpy/common/00gltest.rpy:67
    old "Force Software Renderer"
    new "فرض محركات البرامج"

    # renpy/common/00gltest.rpy:73
    old "Changes will take effect the next time this program is run."
    new "التغييرات سيتم تطبيقها في المرة القادمة تفتح البرنامج"

    # renpy/common/00gltest.rpy:112
    old "Performance Warning"
    new "تحذير تشغيلي"

    # renpy/common/00gltest.rpy:117
    old "This computer is using software rendering."
    new "هذا الحاسوب يستعمل محركات البرامج software rendering"

    # renpy/common/00gltest.rpy:119
    old "This computer is not using shaders."
    new "هذا الحاسوب لا يستعمل اي shaders"

    # renpy/common/00gltest.rpy:121
    old "This computer is displaying graphics slowly."
    new "هذا الحاسوب يستعرض الرسوميات بشكل بطيء"

    # renpy/common/00gltest.rpy:123
    old "This computer has a problem displaying graphics: [problem]."
    new "هذا الحاسوب يواجه مشكلة في عرض الرسوميات [problem]"

    # renpy/common/00gltest.rpy:128
    old "Its graphics drivers may be out of date or not operating correctly. This can lead to slow or incorrect graphics display. Updating DirectX could fix this problem."
    new "محركات الرسوميات قد تكون قديمة او لا تعمل بشكل صحيح. قد يسبب ذلك بطء او اخطاء في الاستعراض, القيام بتحديث directX قد يساعد في حل المشكلة."

    # renpy/common/00gltest.rpy:130
    old "Its graphics drivers may be out of date or not operating correctly. This can lead to slow or incorrect graphics display."
    new " محركات الرسوميات قد تكون قديمة او لا تعمل بشكل صحيح. قد يسبب ذلك بطء او اخطاء في الاستعراض."

    # renpy/common/00gltest.rpy:135
    old "Update DirectX"
    new "تحديث DirectX"

    # renpy/common/00gltest.rpy:141
    old "Continue, Show this warning again"
    new "استمرار, الرجاء عرض هذا التحذير في المرة الثادمة ايضاً"

    # renpy/common/00gltest.rpy:145
    old "Continue, Don't show warning again"
    new "استمرار, لا تعرض هذا التحذير مرة اخرى"

    # renpy/common/00gltest.rpy:171
    old "Updating DirectX."
    new "يتم تحديث DirectX"

    # renpy/common/00gltest.rpy:175
    old "DirectX web setup has been started. It may start minimized in the taskbar. Please follow the prompts to install DirectX."
    new "يتم الآن تنصيب DirectX, قد يبدأ ذلك بشكل مصغر في شريط المهام. الرجاء اتباع التعليمات لاكمال التنصيب."

    # renpy/common/00gltest.rpy:179
    old "{b}Note:{/b} Microsoft's DirectX web setup program will, by default, install the Bing toolbar. If you do not want this toolbar, uncheck the appropriate box."
    new "{b}ملاحظة:{/b} مايكروسوفت دايركت أكس يقوم تلقائياً بتنصيب شريط بينق Bing toolbar. إذا لم ترغب بذلك الرجاء القيام بإلغاء تحديد خانة الاختيار"

    # renpy/common/00gltest.rpy:183
    old "When setup finishes, please click below to restart this program."
    new "حيثن ينتهي التنصيب, الرجاء الضغط ادناه لإعادة تشغيل البرنامج"

    # renpy/common/00gltest.rpy:185
    old "Restart"
    new "إعادة تشغيل"


translate arabic strings:

    # renpy/common/00keymap.rpy:168
    old "Saved screenshot as %s."
    new "تم حفظ الصورة كـ %s"


translate arabic strings:

    # renpy/common/00layout.rpy:421
    old "Are you sure?"
    new "هل انت متأكد؟"

    # renpy/common/00layout.rpy:422
    old "Are you sure you want to delete this save?"
    new "هل انت متأكد من رغبتك في حذف خانة الحفظ هذه؟"

    # renpy/common/00layout.rpy:423
    old "Are you sure you want to overwrite your save?"
    new "هل انت متأكد من رغبتك في الحفظ على هذه الخانة؟"

    # renpy/common/00layout.rpy:424
    old "Loading will lose unsaved progress.\nAre you sure you want to do this?"
    new "الاسترجاع سيضيع كل ما فعلته منذ خانة الحفظ السابقة. \n هل انت متأكد من رغبتك في الاسترجاع إلى هذه النقطة؟"

    # renpy/common/00layout.rpy:425
    old "Are you sure you want to quit?"
    new "هل انت متأكد من رغبتك في الخروج؟"

    # renpy/common/00layout.rpy:426
    old "Are you sure you want to return to the main menu?\nThis will lose unsaved progress."
    new "هل انت متأكد من رغبتك في العودة للقائمة الرئيسية؟ \n كل ما لم تقم بحفظة سيضيع."

    # renpy/common/00layout.rpy:427
    old "Are you sure you want to begin skipping?"
    new "هل أنت متأكد من رغبتك في البدء بالتسريع؟"

    # renpy/common/00layout.rpy:428
    old "Are you sure you want to skip to the next choice?"
    new "هل انت متأكد من رغبتك في التسريع حتى الخيار التالي؟"

    # renpy/common/00layout.rpy:429
    old "Are you sure you want to skip to unseen dialogue or the next choice?"
    new "هل انت متأكد من رغبتك في تسريع الخيارات و الحوار الذي لم يسبق لك قرائته؟"


translate arabic strings:

    # renpy/common/00library.rpy:77
    old "Skip Mode"
    new "وضع التسريع"

    # renpy/common/00library.rpy:80
    old "Fast Skip Mode"
    new "وضع التسريع السريع"


translate arabic strings:

    # renpy/common/00updater.rpy:1258
    old "Updater"
    new "برنامج التحديث"

    # renpy/common/00updater.rpy:1263
    old "An error has occured:"
    new "حصل خطأ:"

    # renpy/common/00updater.rpy:1265
    old "Checking for updates."
    new "جاري البحث عن تحديثات"

    # renpy/common/00updater.rpy:1267
    old "This program is up to date."
    new "هذه النسخة هي الأحدث"

    # renpy/common/00updater.rpy:1269
    old "[u.version] is available. Do you want to install it?"
    new "النسخة [u.version] متوفرة, هل ترغب في تنصيبها؟"

    # renpy/common/00updater.rpy:1271
    old "Preparing to download the updates."
    new "يتم التجهيز لتحميل البرنامج من الانترنت"

    # renpy/common/00updater.rpy:1273
    old "Downloading the updates."
    new "يتم تنزيل التحديثات"

    # renpy/common/00updater.rpy:1275
    old "Unpacking the updates."
    new "يتم فك الضغط عن التحديثات"

    # renpy/common/00updater.rpy:1277
    old "Finishing up."
    new "يتم ختم العملية"

    # renpy/common/00updater.rpy:1279
    old "The updates have been installed. The program will restart."
    new "تم التحديث.. سيتم إعادة تشغيل البرنامج."

    # renpy/common/00updater.rpy:1281
    old "The updates have been installed."
    new "تم التحديث."

    # renpy/common/00updater.rpy:1283
    old "The updates were cancelled."
    new "تم إلغاء التحديث."

    # renpy/common/00updater.rpy:1297
    old "Proceed"
    new "استمرار"

    # renpy/common/00updater.rpy:1300
    old "Cancel"
    new "إلغاء الأمر"


translate arabic strings:

    # renpy/common/_compat/preferences.rpym:411
    old "Joystick Mapping"
    new "خيارات عصى التحكم"


translate arabic strings:

    # renpy/common/_errorhandling.rpym:408
    old "An exception has occurred."
    new "حصل استثناء"

    # renpy/common/_errorhandling.rpym:434
    old "Rollback"
    new "تراجع"

    # renpy/common/_errorhandling.rpym:436
    old "Attempts a roll back to a prior time, allowing you to save or choose a different choice."
    new "يقوم بالتراجع لنقطة سابقة لكي تستطيع اختيار شيء آخر"

    # renpy/common/_errorhandling.rpym:439
    old "Ignore"
    new "تجاهل"

    # renpy/common/_errorhandling.rpym:441
    old "Ignores the exception, allowing you to continue. This often leads to additional errors."
    new "يتجاهل الاستثناء مما يستمح لك بالاستمرار. قد يسبب هذا المزيد من الاخطاء."

    # renpy/common/_errorhandling.rpym:444
    old "Reload"
    new "إعادة المحاولة"

    # renpy/common/_errorhandling.rpym:446
    old "Reloads the game from disk, saving and restoring game state if possible."
    new "يعيد تشغيل اللعبة من القرص الصلب, مع محاولة استعمادة آخر نقطة وحفظها عند الإستطاعة."

    # renpy/common/_errorhandling.rpym:448
    old "Open Traceback"
    new "قراءة التقرير"

    # renpy/common/_errorhandling.rpym:450
    old "Opens the traceback.txt file in a text editor."
    new "يفتح تقرير الخطأ في برنامج الملفات النصية."

    # renpy/common/_errorhandling.rpym:456
    old "Quits the game."
    new "يخرج من اللعبة."

    # renpy/common/_errorhandling.rpym:483
    old "Parsing the script failed."
    new "حصل خطأ أثناء تشغيل النص."

    # renpy/common/_errorhandling.rpym:510
    old "Open Parse Errors"
    new "يفتح قائمة اخطاء التشغيل."

    # renpy/common/_errorhandling.rpym:512
    old "Opens the errors.txt file in a text editor."
    new "يفتح ملف errors.txt في برنامج الملفات النصية"


translate arabic strings:

    # renpy/common/_layout/classic_load_save.rpym:152
    old "a"
    new "ت"

    # renpy/common/_layout/classic_load_save.rpym:161
    old "q"
    new "س"

I had already made small changes like changing "q" for "quick" to "س" for "سريع" and "a" for "automatic" to "ت" for "تلقائي".

Also, I'm going to attach two pictures for the load/save screens. The first one shows the quick or automatic screen and you can clearly see a box (my guess is that it is for the "a" and "q" and I don't know why it is not translated although I changed it in the common file.)
The second one shows how the file is named now.
We don't support lunar calendars, but if you can write a python function that goes from a western-style date or a unix timestamp to a lunar calendar date, we can figure out the right way to add that to Ren'Py. (Also, is that actually unique into the future? http://www.fountainmagazine.com/Issue/d ... r-Calendar makes me think that it would be hard to write code that satisifies everyone.)
I don't think it is necessary to support the lunar calendar as long as the engine saves the files with "الخميس" instead of "Thursday" and "آذار" instead of "March"
Just using the Arabic words for the days and months.

Thank you for your help and if you can help figure how to fix this issue, I'll be very grateful.
Attachments
load-quickempty.PNG
save-file name.PNG

User avatar
PyTom
Ren'Py Creator
Posts: 15152
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: Translating the main menu

#11 Post by PyTom » Thu Mar 24, 2016 8:34 pm

You need to update the translation files in the launcher, and then you should get a bunch of strings like:

"{#weekday}Monday"

and

"{#month}January"
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
"Silly and fun things are important." - Elon Musk
Software > Drama • https://www.patreon.com/renpytom

Fatimah
Regular
Posts: 86
Joined: Tue Mar 01, 2016 2:53 pm
Contact:

Re: Translating the main menu

#12 Post by Fatimah » Sun Mar 27, 2016 5:18 am

PyTom wrote:You need to update the translation files in the launcher, and then you should get a bunch of strings like:

"{#weekday}Monday"

and

"{#month}January"
Hello,

So I have been trying to update the files but no luck so far.

I press on "Generate Translations" and then I write Arabic and then it'll update and after finishing the update, nothing changes.
And when I click again on "Generate Translations", I get the same message for update and the process repeats again.
I tried creating a new project and I installed the latest Renpy, and the same thing happens.

I'm attaching the message I get.
Attachments
update.PNG

User avatar
PyTom
Ren'Py Creator
Posts: 15152
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: Translating the main menu

#13 Post by PyTom » Sun Mar 27, 2016 9:10 pm

I'd suggest just downloading again.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
"Silly and fun things are important." - Elon Musk
Software > Drama • https://www.patreon.com/renpytom

Fatimah
Regular
Posts: 86
Joined: Tue Mar 01, 2016 2:53 pm
Contact:

Re: Translating the main menu

#14 Post by Fatimah » Mon Mar 28, 2016 3:18 am

PyTom wrote:I'd suggest just downloading again.
I did, nothing changed. The files are not updated and I still get the same message.

Fatimah
Regular
Posts: 86
Joined: Tue Mar 01, 2016 2:53 pm
Contact:

Re: Translating the main menu

#15 Post by Fatimah » Mon Oct 03, 2016 4:25 am

Hello,

I have updated Renpy to the latest version & got the translation files.
However, it is not working.

Code: Select all

    # renpy/common/00action_file.rpy:26
    old "{#weekday}Monday"
    new "{#weekday}الاثنين"

    # renpy/common/00action_file.rpy:26
    old "{#weekday}Tuesday"
    new "{#weekday}الثلاثاء"
This is a snippet from the /tl/Arabic/common file.
I also tried with the months.

Code: Select all

# renpy/common/00action_file.rpy:47
    old "{#month}January"
    new "{#شهر} كانون الثاني"

    # renpy/common/00action_file.rpy:47
    old "{#month}February"
    new "{#شهر} شباط"

    # renpy/common/00action_file.rpy:47
    old "{#month}March"
    new "{#شهر} آذار"

    # renpy/common/00action_file.rpy:47
    old "{#month}April"
    new "{#شهر} نيسان"

    # renpy/common/00action_file.rpy:47
    old "{#month}May"
    new "{#شهر} أيار"

    # renpy/common/00action_file.rpy:47
    old "{#month}June"
    new "{#شهر} حزيران"

    # renpy/common/00action_file.rpy:47
    old "{#month}July"
    new "{#شهر} تموز"

    # renpy/common/00action_file.rpy:47
    old "{#month}August"
    new "{#شهر} آب"

    # renpy/common/00action_file.rpy:47
    old "{#month}September"
    new "{#شهر} أيلول"

    # renpy/common/00action_file.rpy:47
    old "{#month}October"
    new "{#شهر}تشرين الأول"

    # renpy/common/00action_file.rpy:47
    old "{#month}November"
    new "{#شهر} تشرين الثاني"

    # renpy/common/00action_file.rpy:47
    old "{#month}December"
    new "{#شهر} كانون الأول"
I'm trying to do this so that the months would appear in Arabic in the save/load screen.

Am I missing something?

Post Reply

Who is online

Users browsing this forum: No registered users