Bilingual with two columns

Comments

56 comments

  • Rainer Grabowski

    Does each line in the fields end with a slash / ?

    0
    Comment actions Permalink
  • Ninh

    Each sentence  end with the "." and after "/" will separate to other row. Or can use other character instead of "/"
    Thanks Rainer

    0
    Comment actions Permalink
  • Rainer Grabowski

    You can try this:

    var a = @text field a.replace(/(<*?>)|\n|\r/g,"").split("/");
    var b = @text field b.replace(/(<*?>)|\n|\r/g,"").split("/");
    var rows = [];
    for(var i = 0; i < a.length; i++){
    rows.push(i + ". | " + a[i] + " | " + b[i]);
    };
    "No. |  Language a | Language b \n" +
    "--- | --- | --- \n" +
    rows.join("\n")

    The problem are the automatically set html tags in the text fields (like <p> text </p> for paragraphs). .replace(/(<*?>)|\n|\r/g,"").split("/"); removes some, but if there are other they can mess up the table.
    If so please sharea screenshot of the calculation where the preview is shown.


    Rainer

    0
    Comment actions Permalink
  • Ninh

    Thank you Rainer,

    i will try this

    0
    Comment actions Permalink
  • Ninh

    Vielen Dank Herr Rainer ,

    You are superman :), my calculation field is “wunderbar”

    I have still one: I have other calculation field “Target Text”:

     

    • Orginal Text (text field) : aaaaa.  Bbbbb . ccccc.
    • Target Text (calculation field) will:

     

    aaaa/

    Bbbbb/

    Ccccc/

    How can display Calculation “Target text” ?

    1. change / replace dot “.” after the end of each sentence in Original Text to “/”character and if any: don’t change other dot “.” that not end of sentence

    2. Remove all hyperlink in Orginal Text

    3, Line break after each new changed character “/” : each sentence put in each different row

     

    Do you any idea or other solution?

    Thanks so much

    0
    Comment actions Permalink
  • Rainer Grabowski

    Hi Ninh,

    can you show an example for this: "and if any: don’t change other dot “.” that not end of sentence"?

    0
    Comment actions Permalink
  • Ninh

    thanks Rainer,

    example for "if any, don’t change other dot “.” that not end of sentence"

    "Podio - We are proud to announce a new way to use Podio with enhanced security features and the 1. option to manage your employees with 1. Sign-on (SSO)." 

    3 dots (.) in this above sentence:

    a. the 1. option

    b. with 1. Sign-on

    c. (SSO).

    and only dot in (c) that end of sentence. and if any, i will change this dot (.) to /

    Other dots (.) in a, b will not change.

    i think that hard to find dot that end of sentence

    Danke sehr

     

     

    0
    Comment actions Permalink
  • Rainer Grabowski

    That's to achieve is there would be only this sentence. But if other sentences follow  - I'm afraid it's impossible for your example. I've a solution which works if there follows a capital letter after the dot only for a new sentence. But in your example Sign-on is in the middle of the sentence and starts with a capital letter, so my solution would set a / line break there.

    Is this a real life example?
     
    Podio - We are proud to announce a new way to use Podio with enhanced security features and the 1. option to manage your employees with 1. Sign-on (SSO). Then follows sentence 2. Followed be sentence three.

    If I understand you right, you want / and line break at this points:
    (SSO)/
    2/
    three/

    Right?

     

    0
    Comment actions Permalink
  • Ninh

    Hi Rainer,
    You are right.
    For multi dot(.) in same sentence is may be impossible.
    My solutiom:
    Step 1: i will manually delete/change dot (.) in each sentence that not end of sentence.

    And then in each sentence has only one (.) at end
    Step 2: use formula calculation fied to change dot (.) to / and break line each sentence.
    Can you help me for step 2?
    Vielen dank
    Ninh

    0
    Comment actions Permalink
  • Rainer Grabowski

    Hi Ninh,
    bitte sehr :)

    Text:

    Podio - We are proud to announce a new way to use Podio with enhanced security features and the 1. option to manage your employees with 1. Sign-on (SSO). Then follows sentence 2. Followed be sentence three.

    Calculation:

    var str = @Text
    b = str.replace(/([.?])\s*(?=[A-Z])/g, "$1|").split("|");
    var c = [];
    for(i = 0; i < b.length; i++){
    c.push(b[i].substr(0,b[i].lastIndexOf(".")) +"/");
    };
    c.join("\n")

    Result:

    Podio - We are proud to announce a new way to use Podio with enhanced security features and the 1. option to manage your employees with 1/
    Sign-on (SSO)/
    Then follows sentence 2/
    Followed be sentence three/

    Rainer

    0
    Comment actions Permalink
  • Ninh

    Vielen Dank Herr Rainer,

    i give you results and some issue that i need you help



    ==========

    Original text:

    “The way I see it, there are seven major tech trends we’re in store for in 2017. If you’re eyeing a sector in which to start a business, any of these is a pretty good bet. If you're already an entrepreneur, think about how you can leverage these technologies to reach your target audience in new ways.

    1 - IoT and Smart Home Tech.

    We’ve been hearing about the forthcoming revolution of the Internet-of-Things (IoT) and resulting interconnectedness of smart home technology for years.”

    Converted text:

    “The way I see it, there are seven major tech trends we’re in store for in 2017//

    If you’re eyeing a sector in which to start a business, any of these is a pretty good bet//

    If you're already an entrepreneur, think about how you can leverage these technologies to reach your target audience in new ways.

    1 - IoT and Smart Home Tech.

    We’ve been hearing about the forthcoming revolution of the Internet-of-Things (IoT) and resulting interconnectedness of smart home technology for years//

     

    ==============

    All text converted good but  Issue in 2 place:

    1. end of paragraph: “  in new ways.” not converted to “in new ways//”
    2. end or Header :1 - IoT and Smart Home Tech.” =>  “1 - IoT and Smart Home Tech//”

     

    Bitte, tell me how to fix it?

    Danke sehr

    0
    Comment actions Permalink
  • Rainer Grabowski

    Multiple reasons why it's not working: There are html tags in, after "ways. " follows a line break and a number not a capital letter.

    Try this instead of the existing replace:

    b = str.replace(/(<([^>]+)>)|\*|\n|\r/ig,"").replace(/([.?])\s*(?=[A-Z0-9])/g, "$1|").split("|");

    0
    Comment actions Permalink
  • Ninh

    awesome, all is correct.

    Sie sind deutsche superman :)

    ich have noch bilingual calculation field, that need your help:

    ==============

    Original text Field (Eng-German):

    THE SEARCH FOR LORNA

    DIE SUCHE NACH LORNA

    Daisy Hamilton was a private detective.

    Daisy Hamilton war Privatdetektivin.

    She was thirty years old and had been a detective for the past two years.

    Sie war dreissig Jahre alt und arbeitete seit zwei Jahren in diesem Beruf.

    ==============================

    Now i want to separate this original Text field (Eng-German) to 2 different language field (calculations field)

    English Field:  only  English and character “//”

    THE SEARCH FOR LORNA //

    Daisy Hamilton was a private detective.//

    She was thirty years old and had been a detective for the past two years//

    German Field:   only German and character “//”

    DIE SUCHE NACH LORNA //

    Daisy Hamilton war Privatdetektivin. //

    Sie war dreissig Jahre alt und arbeitete seit zwei Jahren in diesem Beruf.//

    Note: each sentence end with "/" and break line

    Do you have any idea? 

    vielen Dank und ein shoenes Wochenende

    0
    Comment actions Permalink
  • Rainer Grabowski

    Hi Ninh,

    it's not possible to detect the language in a calculation field. But if your original text field always has the same structure.
    English line break Geman line break English line break Geman line break  ... and so on
    it's possible.

    English field:

    var a = @Text.replace(/\n\n/g,"\n").split("\n")
    var l =[];
    for(var i = 0; i < a.length; i++){
    if(i % 2 > 0){
    l.push(a[i] + "//");
    }};
    l.join("\n")

    German field:

    var a = @Text.replace(/\n\n/g,"\n").split("\n")
    var l =[];
    for(var i = 0; i < a.length; i++){
    if(i % 2 == 0){
    l.push(a[i] + "//");
    }};
    l.join("\n")

    Rainer
    rg@delos-consulting.com

    0
    Comment actions Permalink
  • Ninh

    Vielen Dank Herr Rainer,

    Alles gutes

    These 2 oben calculation English, German work well.

     

    danke sehr

    0
    Comment actions Permalink
  • Ninh

    Hi Herr Rainer,

    i saw the number that separeted  in 2 lines

    Break line in number : No., please see in calcualtion.

    How can this number (No.) in only one line?

    17: right

    wrong:

    1

    7

     Note: i zoom screen from 30%-100% but result is same, (mobile or laptop)

    Calculation

    "

    var a = @text field a.replace(/(<*?>)|\n|\r/g,"").split("/");
    var b = @text field b.replace(/(<*?>)|\n|\r/g,"").split("/");
    var rows = [];
    for(var i = 0; i < a.length; i++){
    rows.push(i + ". | " + a[i] + " | " + b[i]);
    };
    "No. |  Language a | Language b \n" +
    "--- | --- | --- \n" +
    rows.join("\n")"

    0
    Comment actions Permalink
  • Rainer Grabowski

    In markdown tables you can't really control the width of the cells(you can't define the width and you can't have line beaks in a cell). The text in one or multiple cells in the other columns is too long and pushes the first column together.

    You can try this, but I'm not sure if it really helps:

    rows.push("nbsp;nbsp;" + i + ".nbsp;nbsp;"| " + a[i] + " | " + b[i]);
    };
    "nbsp;nbsp;No.nbsp;nbsp; |  Language a | Language b \n" +
    "--- | --- | --- \n" +
    rows.join("\n")

    Or you can try to right align second and third column:

    "--- | ---: | ---: \n" +

    But as I said, I'm afraid it won't solve the problem. I've developed a solution for such problems, but it's much too complex to share it here in the forum. With this solution I can control the cell width and simulate linebreaks in cells,

    Rainer

    0
    Comment actions Permalink
  • Ninh

    thank you

    i will try your solutions.

    In mobile app (android) and ipad : no issue like desktop/laptop

    0
    Comment actions Permalink
  • Rainer Grabowski

    In the mobile apps you don't have real tables cause the Android app doesn't support markdown tables (only some markdown text formatting) and the iOs-App doesn't support any markdown.  

    0
    Comment actions Permalink
  • Ninh

    Danke sehr Herr Rainer

    0
    Comment actions Permalink
  • Ninh

    Sorry Herr Rainer,

    i use your formula : b = str.replace(/(<([^>]+)>)|\*|\n|\r/ig,"").replace(/([.?])\s*(?=[A-Z0-9])/g, "$1|").split("|");

    all situation are good.

    Still 2 situation that not work:

    a/ 1. sentence end with "?" or "!"

    b/ 2. sentence begin with " or '

    in these situation a & b: sentence can not break line and replace //

    my solution in a situation : add manually one dot (.) after ? or ! 

    Can this formula improve please?

    Thanks

     

    0
    Comment actions Permalink
  • Rainer Grabowski

    Just replace ! and ? by !. and ?.  and add " and ' in the condition for waht should follow after a dot (till now it was capital letter or number)

    b = str.replace(/(<([^>]+)>)|\*|\n|\r/ig,"").replace(/!/g,"!.").replace(/\?/g,"?.").replace(/([.?])\s*(?=[A-Z0-9'"])/g, "$1|").split("|");
    0
    Comment actions Permalink
  • Ninh

    Danke Herr Rainer,

    For english: all are good

    For deutsch: some umlaut charaters as Ä, Ö, Ü, ß (capital Letter) begin in 2. sentence.

    And can not break line.

    Example: ich will hier bleiben. Üben, denken,...

    Can i fix this issue with formula:

    b = str.replace(/(<([^>]+)>)|\*|\n|\r/ig,"").replace(/!/g,"!.").replace(/\?/g,"?.").replace(/([.?])\s*(?=[A-ZÄÖÜß0-9'"])/g, "$1|").split("|");
    0
    Comment actions Permalink
  • Rainer Grabowski

    Yes, that's correct. But as far as I know no German word starts with ß

    0
    Comment actions Permalink
  • Ninh

    mein Deutsch :(

    0
    Comment actions Permalink
  • Ninh

    Sehr geehrter Herr Rainer,

    I have one issue with charater “ in 2.sentence in converted - process.

    1. Sentence can not add “//” and break line if 2. Sentence begin with “ : NOT always converted for expected result

    Please see  attacked images:

    2 sentences have same structur, begin with “ but:

    Sentence A: “Focusing on developing” ….: work well for 1. Sentence : add // and break line

    Sentence B: “We had a bit…” : don’t work for 1. Sentence : not add // and don’t break line

    I used this formula with your help: 

    b = str.replace(/(<([^>]+)>)|\*|\n|\r/ig,"").replace(/!/g,"!.").replace(/\?/g,"?.").replace(/([.?])\s*(?=[A-Z0-9'"])/g, "$1|").split("|");

    I think this situation is hard to solve :)

    Danke im Voraus




    0
    Comment actions Permalink
  • Rainer Grabowski

    Did you copy the 2 sentences from different sources into the text field? It seems the quotation marks are not equal. 
    The first one seems to be utf8, the second Ascii. You have to repalce the utf by Ascii. Add another replace

     replace(/[\u201C]/g,'"')

    as second replace.

     

    0
    Comment actions Permalink
  • Ninh

    Danke Herr Rainer,

    gut funktioniert mit new replace formula

    Do you have idea about short word/abbreviation: Mr. A or Ms. B or other short word?

    How can i add some short word into formula? Then after dot (.) and Capital Letter of these short words: not add // and not break line?

    Thank you

    0
    Comment actions Permalink
  • Ninh

    Hallo Herr Rainer,

    I have 3 App: Article (as grand Parent), Sentence (as Parent) and Word (as child)

    In 2 App sentence and word some field calculation are good with help of Herr Rainer.

    Now i need last Calculation in App Article as below table

    Do i need to create relationship between Word app and Article app?

    App Article (grand parent): relationship with App Sentence

    No.                                  First Letter (sort)            Word                  Sentence Order

    1 (add ID link to word Eat)     E                       Eat                                    14

    2 (ID link to word Go)             G                        Go                                     14

    1. L      Luxus                                  3
    2.                                         RRed                    1Note:
    1. sort by First Letter
    2. If any, Sentence order can link direct to “sentence” item (1,3,14). And No. column link to “word” item

    ---------------

     

    App Sentence ( parent): relationship with App Word

    Word list field (done):

    No.                                  First Letter   (sort)          Word              

    1 (add ID link to word Eat)     E                              Eat                       

    2 (ID link to word Go)             G                              Go

    ----------------------------

    App word (child): Go, Eat, Luxus, red items

    ID word Link

    0
    Comment actions Permalink
  • Rainer Grabowski

    You don't need a direct relation between Articles and Words. In Articles you can grab the tables from Sentences, remove the table heads, disassemble each table, add the Sentence order number to each row , sort all rows from all tables and then put them all together in one large table. 

    It's something like:

    var sen = @all of table field in sentences;
    var ord = @all of order number in sentences;
    var rows = [];
    for( var i = 0; i < sen.length; i++){
    senArr = sen[i].split("\n"),
    for(var j = 2; j < senArr.length; j++){
    senOrd = senArr[j] + " | " + ord[i];
    rows.push(senOrd);
    }};
    var rows = rows.sort( function (a,b) {
    a = a.split(" | ")[1];
    b = b.split(" | ")[1];
    return a-b
    }).join("\n).
    "No. | First Letter | Word |  Sentence Order \n" +
    "--- | --- | --- | --- \n" +
    rows

    Rainer

    0
    Comment actions Permalink

Please sign in to leave a comment.

Powered by Zendesk