Famitracker Localization engine - FamiTracker

# FamiTracker

FamiTracker Support Forums

Skip to content

## Famitracker Localization engine

Questions and information regarding the source & NSF driver.
Post Reply

- Print view

7 posts • Page 1 of 1

Roflo
  Posts: 292
  Joined: Thu May 07, 2015 3:51 pm
  Location: Germany
  Contact:
  Contact Roflo
  Website Skype YouTube

### Famitracker Localization engine

- Quote

Post by Roflo » Sun Nov 15, 2015 3:14 pm

A time ago I decided to write a localization 'engine' that requires nearly no changes in the famitracker code itself. It is highly customizable by any user. It is fairly simple:
On startup common controls (static, listbox, listview, r/o edit), menus and windows are subclassed; as soon as the text of a label/menu item is changed or an item is added to a listbox etc., the 'engine' will transparently change anything matching the pattern $!identifier$ with a string taken from a selected language pack.
Language packs can be either loaded from a selected directory or from resource (i.e. using it as the default pack) and can be changed on the fly. Below there's a short introduction. A fully buildable source can be found here (press 'F5' or the stop button to change the language; quite ridiculous for now :p)
Firstly it's necessary to globally #define the symbol YFW_WINDOWS_LOCALE_FAMITRACKER in the project settings. Btw the 'engine's' main code resides in langpack.hpp/.cpp
On startup (InitInstance(), wherever) the 'engine' needs to be initialized (i.e. perfoming the subclassing):

Code: Select all

`//anything is in namespace YFW::Windows::Locale::GuiLocalizer as I might use it in private...
YFW::Windows::Locale::GuiLocalizer::InitializeInstance();
//and of course at the end:
YFW::Windows::Locale::GuiLocalizer::ReleaseInstance();
`
Instantiate LanguagePackSystem, which holds and caches packs, somewhere.
Then select a directory where packs can be found. Language pack files start with a prefix and a suffix; the name in between is taken as the name of the pack.
Ascii, UTF8, UTF16LE and UTF16BE are supported.

Code: Select all

`LanguagePackSystem ps;
ps.setLocation(u"lang", u"lang_", u".txt"); //searches for 'lang_*.txt' in directory ./lang, taking * as the name
`
Storing packs as resource is also possible:

Code: Select all

`YFW::Windows::Locale::LanguagePack &lp = ps.AddPack(); //add empty pack
lp.setName(u"Espa\u00F1a"); //set it's name
lp.LoadResourcePack(IDR_LANGPACK1, u"langpack"); //load from resource
`
After this is done, the language may be freely changed. Labels, Listboxes, Menus etc. are updated:

Code: Select all

`YFW::Windows::Locale::GuiLocalizer::getInstance().ChangeLanguage(ps.RequestPack(u"English")); //load/fetch from cache and set it
`
Of course this needs the resource file to be updated accordingly. Is is also possible to place the pattern above as a MessageBox' text or even use it in file dialogs.
If someone of the Ft developers are interested in, post a comment below
Top

Roflo
  Posts: 292
  Joined: Thu May 07, 2015 3:51 pm
  Location: Germany
  Contact:
  Contact Roflo
  Website Skype YouTube

### Re: Famitracker Localization engine

- Quote

Post by Roflo » Mon Nov 16, 2015 6:55 pm

I'm going to provide a better example and compiled version tomorow.
Top

Roflo
  Posts: 292
  Joined: Thu May 07, 2015 3:51 pm
  Location: Germany
  Contact:
  Contact Roflo
  Website Skype YouTube

### Re: Famitracker Localization engine

- Quote

Post by Roflo » Fri Nov 20, 2015 7:32 pm

I updated the code and attached a basic compiled example, which covers some of the menu bar, edit frame and status bar (notice the 'language' section in the menu bar). It includes additional packs for german, (google translate)french and (google translate)japanese.

Attachments
  famitracker_lc.zip
    (1.33 MiB) Downloaded 414 times

Top

8BitZtunerYT
  Posts: 379
  Joined: Thu Apr 23, 2015 7:20 pm
  Location: Somewhere stuck in Winamp

### Re: Famitracker Localization engine

- Quote

Post by 8BitZtunerYT » Sat Nov 21, 2015 1:04 pm

Thank you based Roflo
slowly ceasing to exist.
"8BitZ caresses his keyboard as he orgasms to the sounds of Winamp."
-retrodpc, 2015
Top

Ralph99
  Posts: 149
  Joined: Sun Jun 21, 2015 9:12 pm
  Location: Rome, Italy
  Contact:
  Contact Ralph99
  YouTube

### Re: Famitracker Localization engine

- Quote

Post by Ralph99 » Sun Nov 22, 2015 12:12 am

Added pack for Italian language.
I hope this project gets more popular... And i know this is still in beta.

Attachments
  famitracker-lc.zip
    Saluti dall'Italia! :)
    (1.3 MiB) Downloaded 395 times

Ciao a tutti! :)
YouTube Account
Top

Roflo
  Posts: 292
  Joined: Thu May 07, 2015 3:51 pm
  Location: Germany
  Contact:
  Contact Roflo
  Website Skype YouTube

### Re: Famitracker Localization engine

- Quote

Post by Roflo » Sun Nov 22, 2015 9:17 am

My intentional idea is to get jsr (or hertzdevil) to integrate this into current famitracker. This way it is easy (or more easily than with resource hacking ) for users to add packs in their language, and then maybe publish it publically so it is taken into the official version of famitracker.
Top

Pinci
  Posts: 1
  Joined: Sun Mar 06, 2016 11:47 pm
  Location: Chile
  Contact:
  Contact Pinci
  YouTube

### Re: Famitracker Localization engine

- Quote

Post by Pinci » Mon Mar 07, 2016 12:08 am

Added Spanish Pack
I hope this feature gets into Famitracker, it's pretty nice for people who don't know english or don't understand it properly.
(Also I recently noticed the old forum isn't being used anymore, I wonder why..?)

Attachments
  famitracker-lc.zip
    (1.33 MiB) Downloaded 390 times

Top

Display posts from previous:
Sort by

Post Reply

- Print view

7 posts • Page 1 of 1

Return to “Source and development”

Jump to

- Rules
- Wiki
- FamiTracker
- General Talk
- Bug Reports
- Feature Requests
- Source and development
- Music
- Original Music
- Cover Music
- Other
- Site Issues & Suggestions