We’re rewarding the question askers & reputations are being recalculated! Read more.
67

Python, Koine Greek - Πύθων My favorite programming language, in my favorite foreign language--perfect! And it doesn't hurt that the name is already Greek. The translator program in Python 3 (thank goodness for native Unicode support): with open(__file__, encoding="utf-8") as f: code = f.read() replacements = [ ("print", "γραψάτω"), ("input", ...


66

Chicken, Chinese - 鸡 Chicken is much harder to use than I thought. There isn't a trailing newline. But the final chicken is just for marking the end of this program, which can be replaced with an empty line. I'm using this interpreter, which prints an extra newline and cannot be suppressed. So the output have one more line than the original, and that can ...


39

JavaScript (ES6), 44 bytes Takes input as an array of ASCII characters. a=>a.map(c=>k+=c<1?k*59:c<'?'?10:c<{},k=0)|k Try it online! How? The Babylonian Numeral System can be seen as a 4-instruction language working with a single register -- let's call it the accumulator. Starting with \$k=0\$, each character \$c\$ in the input array \$a\$...


37

80386 machine code, 13 bytes Hexdump of the code: b0 63 86 01 41 3c 2e 75 f9 c6 01 00 c3 Source code (can be compiled by Visual Studio): __declspec(naked) void __fastcall conv(char s[]) { _asm { mov al, 'c'; // b0 63 myloop: xchg al, [ecx]; // 86 01 inc ecx; // 41 cmp al, '.'; ...


36

C++, Latin - C Plus Plus Yes, that is an actual translation of the language name. They didn't have the plus sign, but they gave us the word plus. #include <iostream> #include <fstream> using namespace std; static const char *reposita[][2] = { // Miscellanea {"iostream", "flumineie"}, // flumine inducto/educto {"ofstream", ...


32

Python 3, 118 116 bytes I=input() t=eval(I[:-1]) u=ord(I[-1])%7 exec("u=-~u%3;t=[t*1.8-459.67,(t-32)/1.8,t+273.15][u];print(t,'FCK'[u]);"*2) Performs the conversions in a rotary order K -> F -> C -> K twice.


28

Retina, 73 bytes T`a-z`ᴀʙᴄᴅᴇꜰɢʜɪᴊᴋʟᴍɴᴏᴘǫʀꜱᴛᴜᴠᴡxʏᴢ This is exactly what Retina's transliterate mode was made for. It replaces all lowercase letters (a-z) with their corresponding small caps version. Annoyingly, the character codes of the small caps characters are all over the place, so it can't take advantage of ranges for the second part: ideally it would ...


26

Pyth, 61 59 58 bytes LXbGsmC+*7389<dGCd"#ʙ'(*ꜰɢʜɪ-.ʟ0ɴ2;ǫʀꜱ>?CDxʏE This defines a named function y. Try it online in the Pyth Compiler/Executor. The code contains no unprintable characters. Idea Among the small caps, there are 14 characters in the range 7424 – 7458, and all of them require three bytes to be stored verbatim. By subtracting ...


25

JavaScript (NodeJS) - Hebrew My method for encoding is pretty similar to DLosc's Python program: It reads the source code, has a list of tokens, and runs find-and-replace. var file_system = require('fs'); file_system.readFile(__filename, function(error,code){ if (error) {throw error;} code = code.toString(); var words = { 'var': 'מש׳', ...


23

bash, 14 bytes iconv -fCP1252 Try it online!


22

Perl, PigLatin - erlPay First, the actual program is very short, so to demonstrate how it behaves for longer sections of text I included some Perl Poetry as a further example of the input/output. Since the poetry is included after the END line it doesn't actually get executed. The actual algorithm is pretty straight forward: Split input into tokens on ...


22

C, 160 bytes g(char*s){char i=1,r=0,*p="k^[#>Pcx.yI<7CZpVgmH:o]sYK$2";for(;*s^'-'&&*s;r+=*s++|9);r=r%45+77;for(;*p!=r;p++,i++);return((*s^'-')?0:g(s+1))+(i<21?i:10*(i-18));} Test it int main () { char* w[] = {"", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten", "eleven", "twelve", "thirteen", "fourteen", "...


22

PHP, 74 bytes foreach(explode(' ',$argn)as$w)$n.='793251_8640'[crc32($w)%20%11];echo+$n; Try it online! Tried to get a solution which doesn't copy existing answers. I get cyclic redundancy checksum polynomial of 32-bit lengths (crc32) for each word and then do a mod 20 and mod 11 on it to get mixed up unique values from 0 to 10 (missing 6) for each digit. ...


20

Excel Formula:), 36 chars =SUBSTITUTE(ADDRESS(1,A1,4),"1","") Usage: Sorry, couldn't resist ...


19

K5, 53 45 bytes {{,/(b+a&~b:x*&\a:9=y){$[x;x#" ";y]}'y}[x]'y} In action: {{,/(b+a&~b:x*&\a:9=y){$[x;x#" ";y]}'y}[x]'y}[4;(,"a";"\t\tb\tc";,"d")] (,"a" " b c" ,"d") I just want the record to show that this question is morally reprehensible.


19

Python 3, 50 67 119 116 112 111 104 94 bytes I'm not fond of going back to %-style string formatting, but it saves 6 bytes on .format. Edit: Forgot to parse input. Edit: Forgot to handle plurals. Edit: Yay lambdas! Edit: Added ungolfing Edit: Darn it. Lambdas didn't help. Edit: Since the minutes have maximum three digits, and int() doesn't mind spaces ...


19

Java 8, 72 66 36 25 bytes s->new String(s,"cp1252") Try it online. s-> // Method with byte-array (UTF-8 by default) as parameter and String return-type new String(s,"cp1252") // Pretend this UTF-8 input is (and convert it to) Windows-1252, // and return it as UTF-8 String (by default) as well cp1252 is an alias for Windows-1252. This ...


17

Visual Basic .Net, Persian I chose a verbose language so it would be harder. Turns out, I didn't have to change the grammar. The Persian form of the code is just as verbose. Imports System.Collections.Generic Module Translator Sub Main() Dim translation As New Dictionary(Of String, String) With translation .Add("imports", "وارد‌کردن") ...


17

Jelly, 15 13 bytes OVBs2UḄị“GCTA Try it online! or verify all test cases. How it works OVBs2UḄị“GCTA Main link. Argument: s (string) O Ordinal; replace each character with its code point. V Eval. This converts the list to a string before evaluating, so it returns the integer that results of concatenating ...


17

JavaScript (ES6), 53 47 bytes f=o=>o.big?o.replace(/./g,' '):o.map?o.map(f):0 Test cases f=o=>o.big?o.replace(/./g,' '):o.map?o.map(f):0 test = [ "", 7, 123.456, "X", " ", "Yo!", [], [-1.2E3], ["Hey"], ["H","e","y"], ["R",2,"D",2], ["C","3","P",0], ["THX",[1138]], ["T","H","X",[1138]], [[["H"],"e",...


17

Python 2, 135 119 115 bytes b=[int('27169735 2 4567 435262'[int(x,36)%141%83%50%23])for x in input()] print b[0]+sum(a*-~b[0]/2for a in b[1:]) Try it online! Input is list of strings from stdin


15

Python 3, 57 bytes lambda s:eval(s.upper().translate({70:'+[',87:']*'})[1:]) Turns a string like f1w0f2w10 into a expression like [1]*0+[2]*10 that it evaluated as code. This is done by turning the string uppercase, turning each f into +[ and each w into ]*, and removing the initial +. Thanks to Dennis for saving 7 bytes in Python 3 by using ...


14

Python: 19 characters lambda s:'c'+s[:-2]


14

CJam, 6 bytes 'clW(< This is a full program which reads the string via STDIN Explanation: 'c "Put character c on stack"; l "Read a line from STDIN"; W "W is a predefined variable with value -1"; ( "Decrease the value by 1"; < "Remove last 2 characters from the string on stack,...


14

Java, German - Java This program is really straight forward. It just reads the file given as the first argument and replaces all occurrences of an English word with the respective German translation. I am using a regular expression with two groups (([^a-zA-Z\\d:])*) to match individual items prepended/followed by a non-alphanumeric character. This solved ...


14

Julia, Tatar - Julia This uses the unofficial Latin-based Zamanälif alphabet for İdel-Ural Tatar, established in 2001. However, in 2002, the Russian Federation struck down Tatarstan's motion to make Zamanälif the official alphabet for the Tatar language, criminalizing the official use of any alphabet other than Cyrillic. In the past century, there have ...


13

CJam, 8 bytes l:i2fbS* Easy-peasy: l:i "Read the input line and convert each character to its ASCII value"; 2fb "Put 2 on stack and use that to convert each ASCII value to base 2"; S* "Join the binary numbers by space"; Try it here


13

Python 3, 41 bytes print(*[bin(ord(x))[2:]for x in input()]) Like KSFT's answer, but I thought I'd point out that, in addition to raw_input -> input, Python 3 also has an advantage here due to the splat for print.


13

CJam, 77 65 60 59 55 54 52 bytes l~2|"459.67+1.8/'K 273.15-'C 1.8*32+'F"S/m<{~N2$}%6< Try it online in the CJam interpreter. How it works l~ e# Read and evaluate the input: F, K, C -> 15, 20, 12 2| e# Bitwise OR with 2: F, K, C -> 15, 22, 14 = 0, 1, 2 (mod 3) "459.67+1.8/'K 273.15-'C 1.8*32+'F"S/ e# Push ["459.67+1.8/K" "273.15-...


13

Rust, Belarusian (Ржа) Program: #![feature(non_ascii_idents)] use std::io::stdin; use std::io::Read; static ЗАМЕНЫ: &'static [(&'static str, &'static str)] = &[ ("match", "супастаўленьне"), (" if ", " калі "), ("else", "інакш"), (" as ", " як "), ("panic!", "паніка!"), ("assert!", "праверыць!"), ("box ", "пак "...


Only top voted, non community-wiki answers of a minimum length are eligible