Skip to content

Commit

Permalink
Create TRANSLATION.md
Browse files Browse the repository at this point in the history
  • Loading branch information
radiorob authored Nov 30, 2022
1 parent 52b110d commit bd53f7d
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions docs/TRANSLATION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

# Translation Guide

# OBServer

OB has a translation function specified in OB.UI.translate and aliased as OB.t. Use OB.t to translate. OB.t accepts 1, 2, or 3 arguments.

- 1 argument: if argument is a string, this string gets returned. If argument is an array, this gets converted to 1, 2, or 3 arguments. (so arguments can be accepted as array too).

- 2 arguments: first argument is namespace, second argument is the string ID. see strings/*.txt for how this looks.

- 3 arguments: first argument is namespace, second argument is string ID, third argument is data array which converts %1, %2, .. %n in string value to data[n].

HTML should have “data-t” attribute to indicate that tag contents should be translated. The tag contents specified in the HTML file will be the string ID.

OB.UI.translateHTML = function( $element ) will do a translation on an element in the DOM.

OB.UI.replaceMain will automatically translate.

OB.UI.addMenuItem and OB.UI.addSubMenuItem will automatically translate.

## OBPlayer

0 comments on commit bd53f7d

Please sign in to comment.