User Tools

Site Tools


en:tutorials:localization

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
en:tutorials:localization [2018/12/25 11:13 (6 months ago)]
sausage [Australian Assets]
en:tutorials:localization [2019/01/02 11:04 (6 months ago)] (current)
sausage
Line 1: Line 1:
-<WRAP center round info 60%> 
-In Progress 
-</​WRAP>​ 
- 
 ====== Localization and Multiple Languages ====== ====== Localization and Multiple Languages ======
  
Line 22: Line 18:
 Begin with a blank project created using the [[en:​tutorials:​creating_your_own_project|init tool]]. Begin with a blank project created using the [[en:​tutorials:​creating_your_own_project|init tool]].
  
-Name your project something like the-conversation (or whatever you wish). ​+Name your project something like ''​the-conversation'' ​(or whatever you wish). ​
  
 Our game will be about two polite gentlemen having a conversation. They continually greet each other all day. Our game will be about two polite gentlemen having a conversation. They continually greet each other all day.
Line 34: Line 30:
 Let's begin with the French assets, building the French version first. Let's begin with the French assets, building the French version first.
  
-Frenchman sprite:+Frenchman sprite ​for the data/​texture folder:
  
 {{ :​tutorials:​typical-frenchman.png |}} {{ :​tutorials:​typical-frenchman.png |}}
  
-Speech samples:+Speech samples ​for the data/sound folder:
  
 {{ :​tutorials:​bonjour1.ogg |}} {{ :​tutorials:​bonjour1.ogg |}}
 {{ :​tutorials:​bonjour2.ogg |}} {{ :​tutorials:​bonjour2.ogg |}}
  
-Music:+Music for the same folder:
  
 {{ :​tutorials:​je-te-veux.ogg |}} {{ :​tutorials:​je-te-veux.ogg |}}
  
  
-Delete the default config ​object ​and FX sections. We wont need those.+Delete the default config ​''​Object'' ​and ''​FX'' ​sections. We wont need those. 
 + 
 +Set up a smaller resolution for this demo by changing the Camera Frustum: 
 + 
 +<code ini> 
 +[MainCamera] 
 +FrustumWidth ​   = 800 
 +FrustumHeight ​  = 600 
 +</​code>​ 
 + 
 +Also turn off the smoothing effect to suit our pixel graphic style: 
 + 
 +<code ini> 
 +[Display] 
 +Smoothing = false 
 +</​code>​
  
 Create the default ''​Person''​ object in the config with: Create the default ''​Person''​ object in the config with:
Line 55: Line 66:
 [Person1] [Person1]
 Graphic ​        = @ Graphic ​        = @
-Texture ​        ​= ​$Image+Texture ​        ​= ​typical-frenchman.png
 Pivot           = center Pivot           = center
 Scale           = 5.0 Scale           = 5.0
Line 187: Line 198:
 Loop        = true Loop        = true
 KeepInCache = true KeepInCache = true
 +</​code>​
 +
 +Add the Timeline to the ''​SpeechObject''​ so that the speech with be animated:
 +
 +<code ini>
 +[SpeechObject]
 +Graphic ​  = SpeechGraphic
 +Scale     = 2
 +Position ​ = (-70, -100)
 +Color     = (0, 128, 255)
 +TrackList = ConversationTimeLine
 </​code>​ </​code>​
  
Line 272: Line 294:
 String = $Hello String = $Hello
  
 +</​code>​
 +
 +Excellent, the localization is now added to all our parts of the config. But there is no way to switch locales. The final step is the define the ''​Space Bar''​ as the key to switch between languages. First the key in the config:
 +
 +<code ini>
 +[MainInput]
 +KEY_ESCAPE ​     = Quit
 +KEY_SPACE = SwitchLanguage
 +</​code>​
 +
 +Define a variable at the top of the code to keep track of the current language:
 +
 +<code c>
 +int currentLanguageIndex = 0;
 +</​code>​
 +
 +Then in code, in the ''​Run()''​ function, switch the locale:
 +
 +<code c>
 +if (orxInput_HasBeenActivated("​SwitchLanguage"​))
 +{
 +    currentLanguageIndex++;​
 +    if (currentLanguageIndex > 1){
 +        currentLanguageIndex = 0;
 +    }
 +   
 +    orxLocale_SelectLanguage(orxLocale_GetLanguage(currentLanguageIndex));​
 +}
 </​code>​ </​code>​
  
Line 278: Line 328:
 {{ :​tutorials:​aussie-screenshot.png |}} {{ :​tutorials:​aussie-screenshot.png |}}
  
-Acknowledgements,​ permissions and thanks +Acknowledgements,​ permissions and thanks: 
-  * Accordion ​performance of Je Te Veux by Norimichi Nagasaka. Youtube channel is at: https://​www.youtube.com/​user/​VAccordion +  * Thank you to Norimichi Nagasaka for allowing me to use his accordion ​performance of Je Te Veux. His Youtube channel is at: https://​www.youtube.com/​user/​VAccordion 
-  * Graphics by Trevor Brennan: http://​trevorbrennan.com +  * Thanks to Trevor Brennan: http://​trevorbrennan.com ​for the graphics. 
-  * Thanks to FullyBugged,​ Dom M ad Matt R for the voices.+  * Thanks to FullyBugged,​ Dom M and Matt R for the voices.
  
en/tutorials/localization.txt · Last modified: 2019/01/02 11:04 (6 months ago) by sausage