I am trying to add multilanguage support to my app. I am doing this by replacing all my User visible Strings with localized strings. For strings like "Cancel", this is easy. But I have just as many strings that are interpolated with information. And the hard part is that each language would build the sentence differently.
For example: How would I localize the following String:
"Please enter the 4-digit Code sent to you at (user.PhoneNumber)"
In German, I want the string to look like this:
"Bitte gebe den 4-Ziffer Code ein, den wir dir an (user.PhoneNumber) gesendet haben"
Or in French:
"Entrez le code à 4 chiffres qui vous a été envoyé à (user.PhoneNumber)"
I am trying to find a way to use some kind of variable inside of my localization file like this (I know that this does not work):
Inside my ViewController:
title.text = "Please enter the 4-digit Code sent to you at %phoneNumber%".localized
Inside my Localizable.string
"Please enter the 4-digit Code sent to you at %phoneNumber%" = "Bitte gebe den 4-Ziffer Code ein, den wir dir an %phoneNumber% gesendet haben"
What's the best practice to do this? This must be some common issue people are having. Languages are so different!
my localized file example:
"email_error_message" = "a link is sent to %# please verify"
Actual code implementation:
let email = smth#email.com
let message = NSLocalizedString("email_error_message", comment: "error, wrong email")
let str = String.localizedStringWithFormat(message, email) //we want to replace %# with email.
Print(str)
** Please note the replaced string/char, in the above case (email) won't be localized.
I have hugo installed in my VPS. I use it mainly for my personal blogs. I mainly write posts in english. But sometimes I need to write posts in non-english language (i.e. Bengali) unicode.
But markdown file's post is not supporting non-enlish unicdoe character.
is there any way to write markdown file (.md) in unicode (non-english)?
List of Steps to Reproduce issue:
1) Filename: Post.md
+++
categories = [""]
comments = true
date = "2019-08-16"
draft = false
showpagemeta = true
showcomments = true
tags = ["tag1", "tag2", "tag3"]
title = "some title"
+++
2) Edit this file with Bengali language (unicode):
+++
categories = [""]
comments = true
date = "2019-08-16"
draft = false
showpagemeta = true
showcomments = true
tags = ["bengalitag1", "bengalitag2", "bengalitag3"]
title = "বাংলা টাইটেল"
+++
আমি বাংলায় গান গাই।
(post in unicode Bengali)
3) Hugo serve working properly and site builds. But unicode posts showing no content, Completely blank Post (including blank title & tag)
any kind of help is appreciated.
Thanks.
I'm programming with Google sites api's.
My requests body consist parameters such as site title and category in non Latin language (Hebrew and Arab).
After the requests are done I see the site title and category name in ??? characters,
which is obviously an encoding problem.
Tried to change and request ContentType header to application/atom+xml;charset=UTF-8 from application/atom+xml
but it's not helping.
Thanks in advance
Using ASCII to html encoding did the trick for me.
Online Converter http://succulent-plant.com/toys/asciitohtml.html
The C# function:
public string ConvertToHtmlEncoding(string inpString)
{
string outString="";
for (var i = 0; i < inpString.Length; i++)
{
outString += "&#"+((int)inpString[i]).ToString()+";";
}
return outString;
}
I'm using the extension seo_dynamic_tag, which is a fantastic plugin for TYPO3 SEO purposes.
It uses registers to store the generated meta description and keywords. Later on in the script, the page metadata is filled in from these registers:
page {
meta {
description {
field >
data = register:description
}
keywords {
field >
data = register:keywordss
}
}
1000 < temp.seo
}
So far it works like charm.
But in addition I'd like to display a TEXT object on the page with the meta description on the bottom. The text should read the meta description and some other stuff. That's where I need your help.
I tried to do the "magic" like this:
temp.description = COA
temp.description {
10 = TEXT
10.value = Meta description: {register:description}
stdWrap.insertData = 1
}
lib.footer < temp.description
This simply does not work. If I want to display something else, for example {page:title} or {date:y-m-d}, data insertion works. For register:xxx it doesn't.
I already spent lots of hours to google out my desired solution, but no success :(
Do you have any idea what I'm missing here?
I'm using TYPO3 4.5.3 (I know I should update ;)).
Many thanks in advance for your help! :)
Your stdWrap.insertData = 1 is applied to your COA-object, and not to your TEXT-object. You can instead set 10.insertData = 1 or just write the following:
10 = TEXT
10.data = register:description
currently I am using the OpenNLP tools to PoS-tag german sentences, with the maxent model listed on their download-site:
de POS Tagger Maxent model trained on tiger corpus. de-pos-maxent.bin
This works very well and I got results as:
Diese, Community, bietet, Teilnehmern, der, Veranstaltungen, die, Möglichkeit ...
PDAT, FM, VVFIN, NN, ART, NN, ART, NN ...
With the tagged sentences I want to do some further processing where I have to know the meaning of the single tags. Unforunately searching the OpenNLP-Wiki for the tag sets isn't very helpful as it says:
TODO: Add more tag sets, also for non-english languages
Does anyone know where can I find the tag set used in the german maxent model?
I created an enum containing the german tags (Reverse lookup is possible):
public enum POSGermanTag {
ADJA("Attributives Adjektiv"),
ADJD("Adverbiales oder prädikatives Adjektiv"),
ADV("Adverb"),
APPR("Präposition; Zirkumposition links"),
APPRART("Präposition mit Artikel"),
APPO("Postposition"),
APZR("Zirkumposition rechts"),
ART("Bestimmer oder unbestimmer Artikel"),
CARD("Kardinalzahl"),
FM("Fremdsprachichles Material"),
ITJ("Interjektion"),
KOUI("unterordnende Konjunktion mit zu und Infinitiv"),
KOUS("unterordnende Konjunktion mit Satz"),
KON("nebenordnende Konjunktion"),
KOKOM("Vergleichskonjunktion"),
NN("normales Nomen"),
NE("Eigennamen"),
PDS("substituierendes Demonstrativpronomen"),
PDAT("attribuierendes Demonstrativpronomen"),
PIS("substituierendes Indefinitpronomen"),
PIAT("attribuierendes Indefinitpronomen ohne Determiner"),
PIDAT("attribuierendes Indefinitpronomen mit Determiner"),
PPER("irreflexives Personalpronomen"),
PPOSS("substituierendes Possessivpronomen"),
PPOSAT("attribuierendes Possessivpronomen"),
PRELS("substituierendes Relativpronomen"),
PRELAT("attribuierendes Relativpronomen"),
PRF("reflexives Personalpronomen"),
PWS("substituierendes Interrogativpronomen"),
PWAT("attribuierendes Interrogativpronomen"),
PWAV("adverbiales Interrogativ- oder Relativpronomen"),
PAV("Pronominaladverb"),
PTKZU("zu vor Infinitiv"),
PTKNEG("Negationspartike"),
PTKVZ("abgetrennter Verbzusatz"),
PTKANT("Antwortpartikel"),
PTKA("Partikel bei Adjektiv oder Adverb"),
TRUNC("Kompositions-Erstglied"),
VVFIN("finites Verb, voll"),
VVIMP("Imperativ, voll"),
VVINF("Infinitiv"),
VVIZU("Infinitiv mit zu"),
VVPP("Partizip Perfekt"),
VAFIN("finites Verb, aux"),
VAIMP("Imperativ, aux"),
VAINF("Infinitiv, aux"),
VAPP("Partizip Perfekt"),
VMFIN("finites Verb, modal"),
VMINF("Infinitiv, modal"),
VMPP("Partizip Perfekt, modal"),
XY("Nichtwort, Sonderzeichen"),
UNDEFINED("Nicht definiert, zb. Satzzeichen");
private final String desc;
private static final Map<String, POSGermanTag> nameToValueMap = new HashMap<String, POSGermanTag>();
static {
for (POSGermanTag value : EnumSet.allOf(POSGermanTag.class)) {
nameToValueMap.put(value.name(), value);
}
}
public static POSGermanTag forName(String name) {
return nameToValueMap.get(name);
}
private POSGermanTag(String desc) {
this.desc = desc;
}
public String getDesc() {
return this.desc;
}
}
It seems very likely that the STTS tag set is used. This tag set is said to be the most common tag set for the German language, e.g. in this question or in this Wikipedia entry.
It is my understanding that the OpenNLP POS tagger for German was trained on the Tiger corpus. This corpus does indeed use the STTS tag set, with minor modifications. I found the following helpful: A Brief Introduction to the Tiger Sample Corpus