From bd53f7d5c9cfcc585b5e83aee59a33ed0b90dad6 Mon Sep 17 00:00:00 2001 From: Rob Hopkins Date: Tue, 29 Nov 2022 17:54:54 -0700 Subject: [PATCH] Create TRANSLATION.md --- docs/TRANSLATION.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 docs/TRANSLATION.md diff --git a/docs/TRANSLATION.md b/docs/TRANSLATION.md new file mode 100644 index 0000000..a93f1d1 --- /dev/null +++ b/docs/TRANSLATION.md @@ -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