Comments (7)
String sConcatHello = "$HELLO"
Debug.Trace( sConcatHello + " world" )
Would log
$Hello world
However, if you sent this to the UI (e.g. AddHeaderOption(sConcatHello + " world")
) and had your translation file as
$Hello Bonjour
$Hello world Hi to the world
it would display as
Hi to the world
since the string it was sending to the UI would be "$Hello world" which is present in the translation table.
The translation isn't done in Papyrus, that wouldn't be sensible because of string caching and case insensitivity. The "translate strings" (i.e. those beginning with a $) are sent to the Scaleform VM and processed there for translation when they're set to a text field.
What is it you are wanting to translate? We (schlangster) recently implemented a, currently undocumented, nested translation system which may be of use.
from skyui.
Well. Something fairly simple. I have text that is concatenated with integers and floats.
string Function decimalDaysToString( Float afDays )
Return Math.Floor( afDays ) + "$DAYS" + (( afDays * 24.0 ) as Int % 24 ) + "$HOURS"
EndFunction
from skyui.
Ah yes, I never thought of something like that!
Leave it with us and we'll see if there's a neat way you can do it.
from skyui.
Cool. Thanks!
from skyui.
Ok here we go, in your translate files have something like
$MYMOD_DAYS{}_HOURS{} Days: {}, Hours: {}
Then in your code, use a function like this to generate your translate string,
string function translateDaysHours(float a_days)
; This function returns the string $MYMOD_DAYS{days}_HOURS{hours}
return "$MYMOD_DAYS{" + Math.floor(a_days) as string + "}_HOURS{" + (( a_days * 24.0 ) as int % 24 ) as string + "}"
endFunction
and when using something like AddHeaderOption()
you can do
float days = 125.4546
...
AddHeaderOption(translateDaysHours(days))
Basically, the {} work as delimiters for replacers, it's a vulgar type of a format string where anything within the curly braces will replace the curly braces in the translate string's value after being, themselves, passed through the translator. We use it for our default text, to avoid having lots of unique translate strings: Our translate files contain $SKI_INFO1{} Default: {}
So we can do things like SetInfoText("$SKI_INFO1{0}")
and it will display Default: 0
or even SetInfoText("$SKI_INFO1{$On}")
so it yields Default: On
I hope this makes sense!
from skyui.
Actually, it makes perfect sense. Thanks!
from skyui.
Excellent 😄
from skyui.
Related Issues (20)
- AddInputOption from API not in code
- Upgrading to the new Skyrim release HOT 1
- MCM Quickstart (Wiki) HOT 2
- Translation of scripts HOT 9
- Any chances to get the source files for SkyUI 5.1? HOT 3
- Forward fixes from 4.1 to 5.2 for SSE
- Skse64 not loading while SkyUi is active HOT 1
- Add support for 21:9 and 32:9 aspect ratios HOT 2
- SkyUI disables itself
- Wiki pull request: fix the MCM Quickstart page formatting HOT 3
- Feature Request: New sort options
- SkyUI Permission Request - Beyond Skyrim HOT 3
- Feature Request: SetInfoText() in event OnSelectST()
- Load panel is broken on ORBIS HOT 71
- SkyUI Compatibility Patch HOT 5
- Utility is no longer available
- Can't equip items on follower
- Wiki API anchored links are broken
- One UI HOT 1
- 1.6.1130 added a new option, breaking the gameplay options menu HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from skyui.