php – Missing post when i switch language from default english to japan

I am using polylang. The default language is english then it displays the news section, but when I switch to JP (japan), the news section is missing.

$news = new WP_Query(‘category_name=news’);
while ( $news->have_posts() ) : $news->the_post();

if (in_category('news-lpga-jlpga')) {   
    $all .= news_item(get_permalink(), get_the_date( 'Y.m.d' ), 'cat01', 'LPGA/JLPGA', get_the_title() );
    $cat01 .= news_item(get_permalink(), get_the_date( 'Y.m.d' ), 'cat01', 'LPGA/JLPGA', get_the_title() );
} elseif (in_category('news-planning'))  { 
    $all .= news_item(get_permalink(), get_the_date( 'Y.m.d' ), 'cat02', '企画', get_the_title() );
    $cat02 .= news_item(get_permalink(), get_the_date( 'Y.m.d' ), 'cat02', '企画', get_the_title() );
} elseif (in_category('news-goods')) { 
    $all .= news_item(get_permalink(), get_the_date( 'Y.m.d' ), 'cat03', '>グッズ', get_the_title() );
    $cat03 .= news_item(get_permalink(), get_the_date( 'Y.m.d' ), 'cat03', '>グッズ', get_the_title() );
} elseif (in_category('new-fun-club'))  {
    $all .= news_item(get_permalink(), get_the_date( 'Y.m.d' ), 'cat04', '>ファンクラブ', get_the_title() );
    $cat04 .= news_item(get_permalink(), get_the_date( 'Y.m.d' ), 'cat04', '>ファンクラブ', get_the_title() );
} else {
    $all .= news_item(get_permalink(), get_the_date( 'Y.m.d' ), "http://wordpress.stackexchange.com/", "http://wordpress.stackexchange.com/", get_the_title() );
}

if(in_category('news-featured')){
    $featured_news .=
    '<a href="http://wordpress.stackexchange.com/" . get_permalink() ."http://wordpress.stackexchange.com/" style ="text-decoration: none;">
        <div class="news_card slide-item-h">
            <img  src="https://wordpress.stackexchange.com/" .  catch_that_image() ."http://wordpress.stackexchange.com/" style="width: 100%; height: auto" alt="http://wordpress.stackexchange.com/" />
            <div class="caption mt-4">
            <p class="news_caption text-muted" style = "font-size: 12px; font-family: Georgia;">' .  get_the_date( 'Y/m/d' ) .'</p>
            <h5 class="news_title " style = "font-size: 16px; font-style: normal; font-family: Cursive; color: #333333;">' .  get_the_title() .'</h5>
            </div>
        </div>
        </a>
    ';
}

endwhile;

calculus and analysis – Series with ArcTan gives wrong symbolic answer in Wolfram Language

Recently, I have found a very uncomfortable problem when using Wolfram Language.
When calculating

Series(ArcTan(A + 1/x), {x, 0, 2},  Assumptions -> A > 0 && x > 0)

I get the wrong answer (tested in wolfram cloud and in Mathematica 12.1.1.0)

wrong answer

I am absolutely sure that the correct answer should be

correct answer

There is a plot of these functions to demonstrate the issue

plot demonstration

How to get rid of the problem?

core language – Intervals v.s. Domains: when to use which and why?

or: How to use Interval correctly?

Mathematica provides these constructs for various symbolic deductions tasks. Among those constructs are symbolic number sets termed domains, which are typically number fields constrained by some inequalities.

Intervals are as well constructs with set-like features: union and intersection arithmetics are supported. On the other hand, they are not handled as usual set objects, since these arithmetics have their separate names (IntervalUnion IntervalIntersection as opposed to Union``Intersection); they even have their own containing test: IntervalMemberQ as opposed to the standard MemberQ which “domains” are allowed to enjoy.

Why is this the case?
Is there a rule of thumb to use Interval correctly?
What is the original intention for the design of Interval,
and why do they seem to be second-class objects compared to “domains”?
Is it a good idea to extensively use composite booleans of inequalities?

Matrix Calculator program in C language. How to avoid redundancy

I am trying to make a program for matrix Calculator and have done this so far. I want to avoid iteration or replication of the statements in my code but I want to restrict using the pointers in this. Can you suggest improvement with the code I can do?

I know I can use structures as well but seems like I see some problem with that. Please help me in suggesting any kind of improvements in this also other feedbacks related to modulation are also acceptable.
Any kind of help will be appreciable. Thanks!

#include <stdio.h>

void matrixReadValues(int rows, int columns, int readInput(rows)(columns));
void matrixPrint(int rows, int columns, int readOutput(rows)(columns));
void matrixAddition(int rows, int columns, int matrix1(rows)(columns), int matrix2(rows)(columns));
void matrixSubtraction(int rows, int columns, int matrix1(rows)(columns), int matrix2(rows)(columns));
void matrixMultiplication(int rowsA, int columnsA, int rowsB, int columnsB, int matrix1(rowsA)(columnsA), int matrix2(rowsB)(columnsB));
void matrixTransposePrint(int rows, int columns, int matrixTranspose(rows)(columns));
int matrixDeterminant(int rows, int columns, int matrixDet(rows)(columns), int matrixOrder);
void matrixRowEchleonForm(int rows, int columns, int matrix1(rows)(columns));

int main(void){
    
    int operation; //used in swtich statements
    char again = 'Y';
    
    int rowsA, columnsA;
    int rowsB, columnsB;
    int matrixA(rowsA)(columnsA);
    int matrixB(rowsB)(columnsB);
    
    while (again == 'Y'){


        //this is the operation menu just type A, B, C or D to calculate
        printf("n tttOperation Menunn");
        printf("t1. to Addn");
        printf("t2. to Subtractn");
        printf("t3. to Multiply two matricesn");
        printf("t4. to find the transpose of the matrixn");
        printf("t5. to find the determinant of the matrixnn");
        printf("t6. to find the rowecheleon form of the matrixnn");
        printf("tEnter your choice: ");
        scanf(" %d", &operation);
        
        switch (operation){
            
        //Case 1 is for addition of 2 matrices 
        
        case 1:
            printf("ntEnter the #rows and #columns for matrix A: ");
            scanf("%d%d", &rowsA, &columnsA);

            printf("tEnter the #rows and #cols for matrix B: ");
            scanf("%d%d", &rowsB, &columnsB);

            while ((rowsA != rowsB) && (columnsA != columnsB)){
                printf("ntMatrices must be of the same sizen");
                printf("ntEnter the #rows and #columns for matrix A: ");
                scanf("%d%d", &rowsA, &columnsA);

                printf("ntEnter the #rows and #cols for matrix B: ");
                scanf("%d%d", &rowsB, &columnsB);

            }


            printf("ntNow Let us enter the elements of Matrix A %d x %d matrix.nn", rowsA, columnsA);
            
            matrixReadValues(rowsA, columnsA, matrixA);
            printf("nttMatrix Ann");
            matrixPrint(rowsA, columnsA, matrixA);
            
            printf("ntNow Let us enter the elements of Matrix B %d x %d matrix.nn", rowsB, columnsB);
            
            matrixReadValues(rowsB, columnsB, matrixB);
            printf("nttMatrix Bnn");
            matrixPrint(rowsB, columnsB, matrixB);
            
            printf("tnAdding the 2 matrices now, we get Matrix A + B:nn");
            matrixAddition(rowsA, columnsA, matrixA, matrixB);


            break;
            
            // Case 2 is for subtraction of the 2 matrices
            case 2:
            printf("ntEnter the #rows and #columns for matrix A: ");
            scanf("%d%d", &rowsA, &columnsA);

            printf("tEnter the #rows and #cols for matrix B: ");
            scanf("%d%d", &rowsB, &columnsB);

            while ((rowsA != rowsB) && (columnsA != columnsB)){
                printf("ntMatrices must be of the same sizen");
                printf("ntEnter the #rows and #columns for matrix A: ");
                scanf("%d%d", &rowsA, &columnsA);

                printf("ntEnter the #rows and #cols for matrix B: ");
                scanf("%d%d", &rowsB, &columnsB);

            }


            printf("ntNow Let us enter the elements of Matrix A %d x %d matrix.nn", rowsA, columnsA);
            
            matrixReadValues(rowsA, columnsA, matrixA);
            printf("nttMatrix Ann");
            matrixPrint(rowsA, columnsA, matrixA);
            
            printf("ntNow Let us enter the elements of Matrix B %d x %d matrix.nn", rowsB, columnsB);
            
            matrixReadValues(rowsB, columnsB, matrixB);
            printf("nttMatrix Bnn");
            matrixPrint(rowsB, columnsB, matrixB);
            
            printf("tnSubtracting the 2 matrices now, we get Matrix A - Matrix B:nn");
            matrixSubtraction(rowsA, columnsA, matrixA, matrixB);


            break;
            
            
        //Case 3 is for addition of 2 matrices 
        
        case 3:
            printf("ntEnter the #rows and #columns for matrix A: ");
            scanf("%d%d", &rowsA, &columnsA);

            printf("tEnter the #rows and #cols for matrix B: ");
            scanf("%d%d", &rowsB, &columnsB);

            while ((rowsA != rowsB) && (columnsA != columnsB)){
                printf("ntMatrices must be of the same sizen");
                printf("ntEnter the #rows and #columns for matrix A: ");
                scanf("%d%d", &rowsA, &columnsA);

                printf("ntEnter the #rows and #cols for matrix B: ");
                scanf("%d%d", &rowsB, &columnsB);

            }


            printf("ntNow Let us enter the elements of Matrix A %d x %d matrix.nn", rowsA, columnsA);
            
            matrixReadValues(rowsA, columnsA, matrixA);
            printf("nttMatrix Ann");
            matrixPrint(rowsA, columnsA, matrixA);
            
            printf("ntNow Let us enter the elements of Matrix B %d x %d matrix.nn", rowsB, columnsB);
            
            matrixReadValues(rowsB, columnsB, matrixB);
            printf("nttMatrix Bnn");
            matrixPrint(rowsB, columnsB, matrixB);
            
            printf("tntMultiplying the 2 matrices now:nn");
            matrixMultiplication(rowsA, columnsA, rowsB, columnsB, matrixA, matrixB);
            
            //Adding the default statemnt if no option matches
            default:
            printf("nIncorrect option! Please choose a number between 1-4.");
            break;
            
        //Case 4 is for doing the transpose of the matrix
            
        case 4:
            printf("ntEnter the #rows and #columns for matrix A: ");
            scanf("%d%d", &rowsA, &columnsA);

            printf("ntNow Let us enter the elements of Matrix %d x %d matrix.nn", rowsA, columnsA);
            
            matrixReadValues(rowsA, columnsA, matrixA);
            printf("nttMatrixnn");
            matrixPrint(rowsA, columnsA, matrixA);
            
            printf("tnDoing the transpose of the above matrix:nn");
            matrixTransposePrint(rowsA, columnsA, matrixA);


            break;
        // Case 5 is for finding the determinant of a matrix    
            case 5:
            printf("ntEnter the #rows and #columns for matrix A. Make sure you add the square matrix: ");
            scanf("%d%d", &rowsA, &columnsA);

            printf("ntNow Let us enter the elements of Matrix %d x %d matrix.nn", rowsA, columnsA);
            
            matrixReadValues(rowsA, columnsA, matrixA);
            printf("nttMatrixnn");
            matrixPrint(rowsA, columnsA, matrixA);
            
            printf("tn Finding the determinant of the above matrix:nn");
            
            int detRecievedFromFunction;
            detRecievedFromFunction = matrixDeterminant(rowsA, columnsA, matrixA, rowsA);
            
            printf("%d", detRecievedFromFunction);


            break;
            
            //Writing the Row Echeleon form
            case 6:
            printf("ntEnter the #rows and #columns for matrix A. Make sure you add the square matrix: ");
            scanf("%d%d", &rowsA, &columnsA);

            printf("ntNow Let us enter the elements of Matrix %d x %d matrix.nn", rowsA, columnsA);
            
            matrixReadValues(rowsA, columnsA, matrixA);
            printf("nttMatrixnn");
            matrixPrint(rowsA, columnsA, matrixA);
            
            printf("tn Finding the RowElcheleon form of the above matrix:nn");
            
            matrixRowEchleonForm(rowsA, columnsA, matrixA);
            
            matrixPrint(rowsA, columnsA, matrixA);


            break;
        }
        
            
    }

}

//Function to read the value from the users
void matrixReadValues(int rows, int columns, int readInput(rows)(columns)){
    
    int i,j;
    for(i=0; i < rows; i++ ){
        for(j=0; j < columns; j++){
            
            printf("tEnter the elemnts (%d)(%d): ", i+1, j+1);
            scanf("%d", &readInput(i)(j));
                        
        }
    }
    
}

//Printing the matrix values

void matrixPrint(int rows, int columns, int readOutput(rows)(columns)){
    
    int i,j;
    for(i=0; i < rows; i++ ){
        for(j=0; j < columns; j++){
            
            printf("t%dt", readOutput(i)(j));
        }
        printf("n");
    }
        
}

//Function to add the 2 matrices

void matrixAddition(int rows, int columns, int matrix1(rows)(columns), int matrix2(rows)(columns)){
    
    int sum(rows)(columns);
    int i,j;
    for(i=0; i < rows; i++ ){
        for(j=0; j < columns; j++){
            
            sum(i)(j) = matrix1(i)(j) + matrix2(i)(j);
            printf("t%dt", sum(i)(j));
        }
        printf("n");               
    }
}

//Function to subtract the 2 matrices

void matrixSubtraction(int rows, int columns, int matrix1(rows)(columns), int matrix2(rows)(columns)){
    
    int difference(rows)(columns);
    int i,j;
    for(i=0; i < rows; i++ ){
        for(j=0; j < columns; j++){
            
            difference(i)(j) = matrix1(i)(j) - matrix2(i)(j);
            printf("t%dt", difference(i)(j));
        }
        printf("n");               
    }
}

//Functrion to multiply the 2 matrices

void matrixMultiplication(int rowsA, int columnsA, int rowsB, int columnsB, int matrix1(rowsA)(columnsA), int matrix2(rowsB)(columnsB)){
    
    int multiply(rowsA)(columnsB);
    int i, j, k;
    
    //Initializing all the elemnts of multiply to 0
    for (i = 0; i<rowsA; ++i)
    
        for (j = 0; j<columnsB; ++j)
        {
            multiply(i)(j) = 0;
        }
    
    
    // Checking whether the user wants to do "AB" or "BA" multiplication
    
    int options;
    printf("t What type of operation do you want to perform from A x B or B x A? <Write either 1 for A x B or 2 for B x A>" );
    scanf("%d", &options);
    
    if(options == 1){
        
        // Running the loop for the multiplication of the 2 matrices 
        for (i = 0; i<rowsA; i++){
        
            for (j = 0; j<columnsB; j++){
            
                for (k = 0; k<columnsA; k++){
                
                  multiply(i)(j) += matrix1(i)(k) * matrix2(k)(j);
                }
            printf("t%dt", multiply(i)(j));
            }
        printf("n");
       }
       
    }
    
    
    else if( options == 2){
        
        // Running the loop for the multiplication of the 2 matrices 
        for (i = 0; i<rowsB; i++){
        
            for (j = 0; j<columnsA; j++){
            
                for (k = 0; k<columnsB; k++){
                
                  multiply(i)(j) += matrix2(i)(k) * matrix1(k)(j);
                }
            printf("t%dt", multiply(i)(j));
            }
        printf("n");
       }
    }
       
    
    
    else {
        
        printf("Please add the appropiate values:");
        printf("What type of operation do you want to perform from A x B or B x A? <Write either 1 for A x B or 2 for B x A>" );
        scanf("%d", &options);
    }
    

}

//Printing the transpose matrix values

void matrixTransposePrint(int rows, int columns, int matrixTranspose(rows)(columns)){
    
    int i,j;
    for(i=0; i < rows; i++ ){
        for(j=0; j < columns; j++){
            
            printf("t%dt", matrixTranspose(j)(i));
        }
        printf("n");
    }
        
}

//Printing the Determinant of Matrix
int matrixDeterminant(int rows, int columns, int matrixDet(rows)(columns), int matrixOrder){
    
    int determinant=0, currentColumn, s = 1, i, j, m, n;
    int subMatrixDet(rows)(columns);  //This is the matrix which extracted from the enterred matrix (matrixDet(rows)(columns)) as a sub matrix
    
    if(matrixOrder == 1){
        
        return(matrixDet(0)(0));
        
    }
    
    else{
        
        // We would be applying the loop to perform the operation for every column
        for(currentColumn = 0; currentColumn < matrixOrder - 1; currentColumn++){
            m = 0, n = 0; //We initialized it because everytime loop will run we will extract new determinant 
            
            //Loop for writing/extracting the sub matrix from the original matrix in order to calculate the minor
            for(i=0; i < matrixOrder; i++){
                for(j=0; j < matrixOrder; j++){
                    
                    subMatrixDet(i)(j) = 0;
                    
                    //Since we have to exclude the element which we multiply with the sub determinant matrix
                    if(i !=0 && j !=0 ){
                        subMatrixDet(m)(n) = matrixDet(i)(j);
                        
                        //Incrementing the Value of n because first the different columns gets filled.
                        if(n < (matrixOrder - 2)){
                            n++;
                        }
                        
                        else{
                            n=0;
                            m++;
                        }
                        
                    }
                    
                }
                
            }   
            
        }
        determinant = determinant + s*(matrixDet(0)(currentColumn) * matrixDeterminant(rows, columns, subMatrixDet, matrixOrder-1) );
        s = -1 * s;
    }
    return determinant;
}

// Converting in the row echleon form
void matrixRowEchleonForm(int rows, int columns, int matrix1(rows)(columns)){
    
    int i,j, nextRow;
    int firstElement;
    int firstElementNextRow;
    for(i = 0; i < rows; i++){
        
        if(matrix1(i)(i) != 1){
            
            firstElement = matrix1(i)(i);
            
            //Checking if the furst element is the 0
            if(firstElement == 0){
                continue; //We are avoiding to divide the first element by 0
            }
            
            //Now dividing the specific row with different column number by the First element of the row
            for(j=0; j < columns ; j++){
                
                matrix1(i)(j) = matrix1(i)(j) / firstElement;
                
            }
            
        }
        
        for(nextRow = i + 1; nextRow < rows; nextRow++){
            
            //We are now subtracting the next row with the previous row in order to make the very first elements 0
            firstElementNextRow = matrix1(nextRow)(i);
            
            for(j=0; j < columns; j++){
                
                matrix1(nextRow)(j) = matrix1(nextRow)(j) - (matrix1(i)(j) * firstElementNextRow);
            }
        }
        
    }
}

```

Offering translation service from any language to English, french and any other for $5

Offering translation service from any language to English, french and any other

Translation will be done professionally and manually (Never trusted those translation apps anyway). I always proofread the translation before delivery to the client.

i will translate any text up to 400 words in less than 48 hours for $5.Translation will be done professionally and manually (Never trusted those translation apps anyway). I always proofread the translation before delivery to the client.

All documents and personal information absolutely confidential!

Hindi English French

  • Chinese (Simplified)Nepali

.(tagsToTranslate)translate(t)translation(t)TranslateEnglis(t)TranslateUrdu(t)TranslateFrench

finite automata – Using Myhill Nerode to prove a language is not regular

Let $L$ be your language and let $equiv$ be the equivalence relation defined by $x equiv y$ iff $x in Sigma^*$ and $y in Sigma^*$ have no distinguishing extension (a distinguishing extension is a word $z in Sigma^*$ such that exactly one of $xz$ and $yz$ belongs to $L$).

Given $i,j in mathbb{N}$ with $i < j$, $0^i$ and $0^j$ cannot belong the same equivalence class since $1^i$ is a distinguishing extension for them: $0^i 1^i in L$ but $0^j 1^i notin L$.

This shows that $L/equiv$ is not finite, and hence $L$ is not regular.

licensing – Can I rewrite GNU GPL v3 code in another language and use it in a commercial app?

An open-source library that is written in C++ under the “GNU General Public License v3” license, can be rewritten in C# to be used in a commercial application?

I know this question is similar to this one, but it was about v2 and the accepted answer reports a part of v2 licensing that I can’t find for v3.

finite automata – prove that if a language is regular then so is the reverse of that language

Below is a problem from Dexter C Kozen’s Automata and Computability followed by my attempt at a solution. Please provide feedback on my proof. Are there any errors/leaps in logic?

$$$$
Problem Statement
$$$$
My attempt:

$T$ is regular if and only if there exists a NFA accepting $T$. Let $N=(Q,∑,Δ,S,F)$ such that $L(N)=T.$

I will show that there exists a NFA accepting $T$ if and only if there exist a NFA $N_{R}=(Q,∑,Δ_R,S_R,F_R)$ such that $L(N_R)=revT.$

Define: $Δ_R(q,a)={p in Q : q in Δ(p,a)}$, $S_R=F$, $F_R=S$

Lemma 1: if $A⊆Q, $ then $hat{Δ}_R(hat{Δ}(A,x),rev(x))=A$ for all $x in ∑^✱$.

Base Cases:

$$hat{Δ}_R(hat{Δ}(A,ε),ε)=hat{Δ}_R(A,ε)=A$$ by Kozen (6.1). So, equality holds for the empty string.

$$hat{Δ}_R(hat{Δ}(A,a),rev(a))=$$$$bigcup_{qinhat{Δ}(A,a) } {p in Q : q in Δ(p,a) }=$$

$${p in Q : Δ(p,a) ∩ hat{Δ}(A,a) not =∅ }=A$$
by Kozen (6.2), the fact that $rev(a)=a$, and the definition of $Δ_R$.

Inductive Step:

Assume $hat{Δ}_R(hat{Δ}(A,x),rev(x))=A$.

$$hat{Δ}_R(hat{Δ}(A,xa),rev(xa))=hat{Δ}_R(hat{Δ}(A,xa),arev(x))=$$

by definition of string reversal in problem statement.
$$hat{Δ}_R(bigcup_{qinhat{Δ}(A,x)}Δ(q,a), arev(x)) $$

by Kozen definition (6.2) page 33

$$bigcup_{qinhat{Δ}(A,x)}hat{Δ}_R(Δ(q,a), arev(x)) $$

by Kozen Lemma 6.2 page 34

$$bigcup_{qinhat{Δ}(A,x)}hat{Δ}_R(hat{Δ}_R(Δ(q,a), a),rev(x))= $$

by Kozen Lemma 6.1

$$hat{Δ}_R(hat{Δ}_R(hat{Δ}(A,xa), a),rev(x))= $$

by Kozen Lemma 6.2

$$hat{Δ}_R(hat{Δ}_R(hat{Δ}(hat{Δ}(A,x),a), rev(a)),rev(x))= $$

by Kozen Lemma 6.1 and by the fact that $rev(a)=a$

$$hat{Δ}_R(hat{Δ}(A,x),rev(x))= $$

by the base case for a single character

$$A$$ by assumption.

Lemma 2: $hat{Δ}(A ∩ B,x)= hat{Δ}(A,x) ∩ hat{Δ}(B,x)$

Base Case:

$hat{Δ}(A ∩ B,ε)=A ∩ B= hat{Δ}(A,ε) ∩ hat{Δ}(B,ε)$ by definition (6.1) kozen

Inductive step:

Assume $hat{Δ}(A ∩ B,x)= hat{Δ}(A,x) ∩ hat{Δ}(B,x)$

$$hat{Δ}(A ∩ B,xa)=bigcup_{qinhat{Δ}(A∩ B,x)}Δ(q,a)=$$
by definition (6.2) kozen
$$bigcup_{qin(hat{Δ}(A,x)∩ hat{Δ}( B,x))}Δ(q,a)=$$
by assumption
$$bigcup_{qinhat{Δ}(A,x)}Δ(q,a)∩bigcup_{qinhat{Δ}(A,x)}Δ(q,a)=hat{Δ}(A,xa)∩hat{Δ}(B,xa)$$
by definition (6.2) kozen and basic set theory

Now I will use lemma 1 and lemma 2 to show $x in L(N)$ IFF $rev(x) in L(N_R)$

$x in L(N)$ IFF $hat{Δ}(S,x)∩F not = ∅$ IFF

$hat{Δ_R}(hat{Δ}(S,x)∩F,rev(x)) not = hat{Δ_R}(∅,rev(x)) $ IFF

$hat{Δ_R}(hat{Δ}(S,x),rev(x)) ∩hat{Δ_R}(F,rev(x)) not = ∅ $, by lemma 6.2, IFF

$S ∩hat{Δ_R}(F,rev(x)) not = ∅ $, by lemma 6.1, IFF

$F_R ∩hat{Δ_R}(S_R,rev(x)) not = ∅$, by definition of $F_R,S_R$, IFF

$rev(x) in L(N_R)$ $∎$

views – Get the user’s current language code

How can I get the user’s current language code in a view as a raw value, for example en or fr-ca?

This isn’t for filtering content. I need the raw value of the users’ current language to pass into a URL for a third-party tool. I added a custom text field. Then placed in some Twig code. The code is just failing to the fallback else value.

Based on other forum posts, I tried this code.

{% if language.getId() == 'en' %}
  en
{% elseif language.getId() == 'es-us' %}
  es-us
{% elseif language.getId() == 'en-us' %}
  en-us
{% else %}
  failed
{% endif %}

I get failed.

{% if language == 'en' %} 
  en
{% elseif language == 'es-us' %}
  es-us
{% elseif language == 'en-us' %}
  en-us
{% else %}
  failed
{% endif %}

I still get failed.

{% if language.id() == 'en' %}
  en
{% elseif language.id() == 'es-us' %}
  es-us
{% elseif language.id() == 'en-us' %}
  en-us
{% else %}
  failed
{% endif %}

I still get the same output.