'How to enable WPML to translate my content widget?

I'm developing a WordPress plugin and would like to know how I may translate a text from the plugin's database table using WPML.

Here's a sample of the code I want WPML to translate into multiple languages:

 echo esc_html_e('Contact with','my-plugin') ." ". esc_attr($name);

 *$name it's called from my plugin table in WordPress Database*

How do I translate "Contact with" and $name with WPML's multiple language support?



Solution 1:[1]

You will need to use String translation for the translation of each string. If you don't see a string at first you will need to find the strings first.

For more details take a look at https://wpml.org/documentation/getting-started-guide/translating-widgets

Solution 2:[2]

All you need to do is to concatenate your original input with the output of classification and apply your regression model there, you do not specify "extra" inputs.

So it will become something among the lines of:

input1_classification = Input(shape=(3,))

# classsfication 
hidden1 = Dense(20, activation='relu', kernel_initializer='he_normal'(input1_classification)
outputout_classification = Dense(2, activation='softmax')(hidden1)

# regression input 
new_input = Concatenate(axis=1)([input1_classification, outputout_classification ])
hidden2 = Dense(10, activation='relu', kernel_initializer='he_normal'(new_input)
out_reg_final = Dense(1)(hidden2)

# define model
model = Model(inputs=input1_classification, outputs=[out_classification, out_reg_final])
# compile the keras modelmodel.compile(loss['sparse_categorical_crossentropy','mse'], optimizer='adam')

# fit the keras model on the dataset
model.fit(X_train, [y_train_class,y_train_reg], epochs=150, batch_size=32, verbose=2)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 KWriter
Solution 2 lejlot