Template talk:Foreignlang

From Wikipedia, the free encyclopedia

(moved from Help desk:)


I recently created Template:Foreignlang (See fuller explanation its purpose here). Right now, the 2nd and 3rd parameters seem to be working, but I don't know how to code for the first parameter (The first parameter decides the language of the output, using the 2 letter identifications for the international wikipedias. en for English, ar for Arabic, ru for Russian, and so on).

{{Foreignlang|en|Example1|Example}} curently produces:


[edit] Welcome

You recently created a Wikipedia article at Example1. Unfortunately, this is the English Wikipedia, so content written in other languages is not suitable. If you would like to contribute to the English Wikipedia, which is exclusively for your language, please create an account there. Thanks.

P.S. The topic you have written about has already been started here, you may edit that article.


(That is just an example case. In reality, "en" would never be sent as the first parameter, as this is the English Wikipedia. Nor would the message be in English.)

Basically I want the first parameter to be what decides the outcome of a Switch statement will be. case1 would be one language, case2 would be another, and so on.

Thanks. --ĶĩřβȳŤįɱéØ 21:14, 4 January 2007 (UTC)

But this requires the person using the template to know what language the offending article was written in. Is it worth the trouble? Seems to me you'd be sending the wrong message if you're telling someone to use English but you yourself are using another, even if you're trying to accommodate them. Xiner (talk, email) 21:31, 4 January 2007 (UTC)
Regarding your first point, yes. Seeing how I created this template with the intention of using it for when I know for sure what the language is, I don't see what's wrong with that. Regarding your second point, I'm not telling them to use English. I am telling them to use the language of the Wikipedia into which they entered the article, in this case English (something that would never happen in the actual use of this template, unless it was transwikied). And then I provide them with a link to the Wikipedia of their own language. I think this confusion may have occurred as a result of en.wikipedia being in the template code. I changed it so it now says {{{1}}}.wikipedia.org --ĶĩřβȳŤįɱéØ 22:01, 4 January 2007 (UTC)
So what exactly is your question? How to use the switch? Would you like me to have a stab at it? — Sebastian 22:26, 4 January 2007 (UTC)
I wanted to know how exactly to translate the switch statement in Java to Wikiese markup language or whatever its called. If you want to help in making the template, by all means go ahead. --ĶĩřβȳŤįɱéØ 00:33, 5 January 2007 (UTC)
You can't write Java on Wikipedia. Check out m:ParserFunctions. BigNate37(T) 01:01, 5 January 2007 (UTC)
"You can't write Java on Wikipedia." uh...? I didn't ask for that.--ĶĩřβȳŤįɱéØ 07:31, 5 January 2007 (UTC)
That's only part of what BigNate37 said. The helpful part of his message (Thank you, BigNate37!) was the link he provided, which gives the following syntax:
                                   {{#switch: <comparison value>
                                    | <value1> = <result1>
                                    | <value2> = <result2>
                                    | ...
                                    | <valuen> = <resultn>
                                    | <default result>
                                   }}
Does this help? — Sebastian 09:26, 5 January 2007 (UTC)
To clarify, it's not a matter of translating Java to wiki markup. The switch construct predates Java, and in general there is no way to translate Java into wiki markup. It's just a matter of terminology—I knew what you meant, but others may not have. I could have perhaps been more verbose in my correcting you so as to be less terse, but I have a habit of over-talking things. Either way, you have the information you need with the parser functions. I'd be happy to answer any other specific questions should you have them. BigNate37(T) 14:22, 5 January 2007 (UTC)