-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathi18n-utils.gs
64 lines (54 loc) · 1.55 KB
/
i18n-utils.gs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
var IOS_obj = new function(){
this.id = "ios"
this.sheetName = "i18n-ios";
this.commentHeader = "/*******************************";
this.commentFooter = "*******************************/";
this.oneLineComment = function(comment){
return "// " + comment;
}
this.keyPairCode = function(key, value){
if (value.includes(AOS_obj.variableStr)){
let final_val = value.replaceAll(AOS_obj.variableStr, this.variableStr)
return '"' + key + '" = "' + final_val + '";';
}
return '"' + key + '" = "' + value + '";';
}
this.variableStr = "%@";
}
var AOS_obj = new function(){
this.id = "aos"
this.sheetName = "i18n-aos"
this.commentHeader = "<!--"
this.commentFooter = "-->"
this.oneLineComment = function(comment){
return "<!-- " + comment + " -->"
}
this.keyPairCode = function(key, value){
if (value.includes(IOS_obj.variableStr)){
let final_val = value.replaceAll(IOS_obj.variableStr, this.variableStr)
return '<string name="' + key + '">' + final_val + '</string>'
}
return '<string name="' + key + '">' + value + '</string>'
}
this.variableStr = "%s";
}
// ----------------------
function columnToLetter(column)
{
var temp, letter = '';
while (column > 0)
{
temp = (column - 1) % 26;
letter = String.fromCharCode(temp + 65) + letter;
column = (column - temp - 1) / 26;
}
return letter
}
// add custom sentences to every column
function addCustom(comment, numOfLang){
var row = new Array()
for (var i=0; i<numOfLang; i++){
row.push(comment)
}
return row
}