Translation refactoring - part 3 (all JSONs) (#2205)

* Refactoring: Split reading and writing of translation files

* New generator of translation strings from JSONs

* Switch to the new strings generation approach

* Using the regex for similar strings + bugfix for Submarines

* Transfer of the existing translations

* Clean up of the template file and translated files based on it

* Unit tests are updated

Co-authored-by: Yair Morgenstern <yairm210@hotmail.com>
This commit is contained in:
Jack Rainy 2020-03-21 20:32:04 +02:00 committed by GitHub
parent 75c71700db
commit d7ac7f9173
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
30 changed files with 18558 additions and 19459 deletions

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1323,7 +1323,7 @@ Cannon = ปืนใหญ่
Musketman = พลปืน
Musketeer = ทหารเสือ
Janissary = ทัพจานิสซารี่
Heals [amountHealed] damage if it kills a unit = ฟื้นฟูพลังชีวิต [amountHealed] เมื่อฆ่ายูนิต
Heals [amount] damage if it kills a unit = ฟื้นฟูพลังชีวิต [amount] เมื่อฆ่ายูนิต
Minuteman = ทหารกองหนุนอเมริกา
Frigate = เรือใบรบ
Ship of the Line = เรือแนวเส้นประจัญบาน
@ -1355,7 +1355,7 @@ Invisible to others = ล่องหนในสายตาผู้อื่
Can only attack water = โจมตีเฉพาะในน้ำ
Carrier = เรือบรรทุกอากาศยาน
Triplane = เครื่องบินปีกซ้อนสามชั้น
[percent]% chance to intercept air attacks = [percent]% โอกาสท่จะสวนกลับการโจมตีทางอากาศ
[amount]% chance to intercept air attacks = [amount]% โอกาสท่จะสวนกลับการโจมตีทางอากาศ
Requires Manhattan Project = ต้องการ แมนฮัตตันโปรเจค
6 tiles in every direction always visible = จะมองเห็นทุกช่องในระยะ 6 ช่อง
Great War Bomber = เครื่องบินทิ้งระเบิดในสงครามที่ยิ่งใหญ่
@ -1383,7 +1383,7 @@ Great Scientist = นักวิทยาศาสตร์ผู้ยิ่
Can hurry technology research = สามารถเร่งการค้นคว้าเทคโนโลยีได้
Can build improvement: Academy = สามารถสร้างสถานศึกษาได้
Great Merchant = พ่อค้าผู้ยิ่งใหญ่
Can undertake a trade mission with City-State, giving a large sum of gold and [influenceAmount] Influence = สามารถนำร่องภารกิจการค้ากับเมือง จะให้ทองมหาศาล และ [influenceAmount] ค่าอิทธิพล
Can undertake a trade mission with City-State, giving a large sum of gold and [amount] Influence = สามารถนำร่องภารกิจการค้ากับเมือง จะให้ทองมหาศาล และ [amount] ค่าอิทธิพล
Can build improvement: Customs house = สามารถสร้างโรงภาษีได้
Great Engineer = วิศวกรผู้ยิ่งใหญ่
Can speed up construction of a wonder = ทำให้การสร้างสิ่งมหัศจรรย์เสร็จเร็วขึ้น

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -21,269 +21,12 @@ Oh no! It looks like something went DISASTROUSLY wrong! This is ABSOLUTELY not s
# Buildings
## Ancient era buildings
Palace =
Indicates the capital city =
Monument =
Granary =
Stone Works =
Must not be on plains =
Stonehenge =
'Time crumbles things; everything grows old and is forgotten under the power of time' - Aristotle =
Library =
+1 Science Per 2 Population =
Paper Maker =
The Great Library =
Free Technology =
'Libraries are as the shrine where all the relics of the ancient saints, full of true virtue, and all that without delusion or imposture are preserved and reposed.' - Sir Francis Bacon =
Circus =
Walls =
Walls of Babylon =
The Pyramids =
'O, let not the pains of death which come upon thee enter into my body. I am the god Tem, and I am the foremost part of the sky, and the power which protecteth me is that which is with all the gods forever.' - The Book of the Dead, translated by Sir Ernest Alfred Wallis Budge =
Worker construction increased 25% =
Provides 2 free workers =
Barracks =
Krepost =
Culture and Gold costs of acquiring new tiles reduced by 25% in this city =
Colossus =
'Why man, he doth bestride the narrow world like a colossus, and we petty men walk under his huge legs, and peep about to find ourselves dishonorable graves.' - William Shakespeare, Julius Caesar =
+1 gold from worked water tiles in city =
Temple =
Burial Tomb =
Doubles Gold given to enemy if city is captured =
Mud Pyramid Mosque =
The Oracle =
'The ancient Oracle said that I was the wisest of all the Greeks. It is because I alone, of all the Greeks, know that I know nothing' - Socrates =
Free Social Policy =
Lighthouse =
Can only be built in coastal cities =
+1 food from Ocean and Coast tiles =
The Great Lighthouse =
'They that go down to the sea in ships, that do business in great waters; these see the works of the Lord, and his wonders in the deep.' - The Bible, Psalms 107:23-24 =
All military naval units receive +1 movement and +1 sight =
National College =
Chichen Itza =
'The katun is established at Chichen Itza. The settlement of the Itza shall take place there. The quetzal shall come, the green bird shall come. Ah Kantenal shall come. It is the word of God. The Itza shall come.' - The Books of Chilam Balam =
Golden Age length increases +50% =
Courthouse =
Remove extra unhappiness from annexed cities =
Can only be built in annexed cities =
Stable =
+15% Production when building Mounted Units in this city =
Circus Maximus =
Hanging Gardens =
'I think that if ever a mortal heard the word of God it would be in a garden at the cool of the day.' - F. Frankfort Moore =
Colosseum =
Terracotta Army =
'Regard your soldiers as your children, and they will follow you into the deepest valleys; look on them as your own beloved sons, and they will stand by you even unto death.' - Sun Tzu =
Market =
Bazaar =
Provides 1 extra copy of each improved luxury resource near this City =
+2 Gold for each source of Oil and oasis =
Monastery =
Notre Dame =
'Architecture has recorded the great ideas of the human race. Not only every religious symbol, but every human thought has its page in that vast book.' - Victor Hugo =
Hagia Sophia =
'For it soars to a height to match the sky, and as if surging up from among the other buildings it stands on high and looks down upon the remainder of the city, adorning it, because it is a part of it, but glorying in its own beauty' - Procopius, De Aedificis =
+33% great person generation in all cities =
Mint =
Machu Picchu =
'Few romances can ever surpass that of the granite citadel on top of the beetling precipices of Machu Picchu, the crown of Inca Land.' - Hiram Bingham =
Gold from all trade routes +25% =
Must have an owned mountain within 2 tiles =
Aqueduct =
40% of food is carried over after a new citizen is born =
Great Wall =
'The art of war teaches us to rely not on the likelihood of the enemy's not attacking, but rather on the fact that we have made our position unassailable.' - Sun Tzu =
Enemy land units must spend 1 extra movement point when inside your territory (obsolete upon Dynamite) =
Workshop =
Longhouse =
+1 Production from each worked Forest tile =
Forge =
+15% production of land units =
Increases production of spaceship parts by 15% =
Harbor =
+1 production from all sea resources worked by the city =
Connects trade routes over water =
University =
+2 Science from each worked Jungle tile =
Wat =
Oxford University =
Castle =
Mughal Fort =
Alhambra =
'Justice is an unassailable fortress, built on the brow of a mountain which cannot be overthrown by the violence of torrents, nor demolished by the force of armies.' - Joseph Addison =
All newly-trained melee, mounted, and armored units in this city receive the Drill I promotion =
Angkor Wat =
'The temple is like no other building in the world. It has towers and decoration and all the refinements which the human genius can conceive of.' - Antonio da Magdalena =
Cost of acquiring new tiles reduced by 25% =
Porcelain Tower =
'Things always seem fairer when we look back at them, and it is out of that inaccessible tower of the past that Longing leans and beckons.' - James Russell Lowell =
Free great scientist appears =
Science gained from research agreements +50% =
Ironworks =
Armory =
Observatory =
Opera House =
Sistine Chapel =
'I live and love in God's peculiar light.' - Michelangelo Buonarroti =
Culture in all cities increased by 25% =
Bank =
Hanse =
+5% Production for every Trade Route with a City-State in the empire =
Satrap's Court =
Forbidden Palace =
'Most of us can, as we choose, make of this world either a palace or a prison' - John Lubbock =
Unhappiness from population decreased by 10% =
Theatre =
Leaning Tower of Pisa =
'Don't clap too hard - it's a very old building.' - John Osbourne =
Free Great Person =
Choose a free great person =
Get =
Himeji Castle =
'Bushido is realized in the presence of death. This means choosing death whenever there is a choice between life and death. There is no other reasoning.' - Yamamoto Tsunetomo =
+15% combat strength for units fighting in friendly territory =
Taj Mahal =
'The Taj Mahal rises above the banks of the river like a solitary tear suspended on the cheek of time.' - Rabindranath Tagore =
Empire enters golden age =
Windmill =
Must not be on hill =
Museum =
Hermitage =
The Louvre =
'Every genuine work of art has as much reason for being as the earth and the sun' - Ralph Waldo Emerson =
Free Great Artist Appears =
Seaport =
+1 production and gold from all sea resources worked by the city =
+15% production of naval units =
Public School =
Hospital =
25% of food is carried over after a new citizen is born =
Factory =
Stock Exchange =
Big Ben =
'To achieve great things, two things are needed: a plan, and not quite enough time.' - Leonard Bernstein =
-15% to purchasing items in cities =
Cristo Redentor =
'Come to me, all who labor and are heavy burdened, and I will give you rest.' - New Testament, Matthew 11:28 =
Culture cost of adopting new Policies reduced by 10% =
Kremlin =
'The Law is a fortress on a hill that armies cannot take or floods wash away.' - The Prophet Muhammed =
Defensive buildings in all cities are 25% more effective =
Neuschwanstein =
'...the location is one of the most beautiful to be found, holy and unapproachable, a worthy temple for the divine friend who has brought salvation and true blessing to the world.' - King Ludwig II of Bavaria =
+1 happiness, +2 culture and +3 gold from every Castle =
Military Academy =
Brandenburg Gate =
Free Great General appears near the Capital =
'Pale Death beats equally at the poor man's gate and at the palaces of kings.' - Horace =
Broadcast Tower =
Eiffel Tower =
'We live only to discover beauty, all else is a form of waiting' - Kahlil Gibran =
Provides 1 happiness per 2 additional social policies adopted =
Statue of Liberty =
'Give me your tired, your poor, your huddled masses yearning to breathe free, the wretched refuse of your teeming shore. Send these, the homeless, tempest-tossed to me, I lift my lamp beside the golden door!' - Emma Lazarus =
+1 Production from specialists =
Medical Lab =
Research Lab =
Hydro Plant =
Stadium =
Solar Plant =
Must be next to desert =
Must be next to mountain =
Sydney Opera House =
'Those who lose dreaming are lost.' - Australian Aboriginal saying =
+1 population in each city =
+1 happiness in each city =
Pentagon =
'In preparing for battle I have always found that plans are useless, but planning is indispensable.' - Dwight D. Eisenhower =
Gold cost of upgrading military units reduced by 33% =
Manhattan Project =
Enables nuclear weapon =
Apollo Program =
Enables construction of Spaceship parts =
Nuclear Plant =
Spaceship Factory =
Increases production of spaceship parts by 50% =
Spaceship part =
SS Booster =
SS Cockpit =
SS Engine =
SS Stasis Chamber =
Hubble Space Telescope =
'The wonder is, not that the field of stars is so vast, but that man has measured it.' - Anatole France =
2 free great scientists appear =
Increases production of spaceship parts by 25% =
# Diplomacy,Trade,Nations
Requires [buildingName] to be built in the city =
@ -501,7 +244,6 @@ Viking Fury =
Uniques =
Promotions =
Barbarians =
Load copied data =
Could not load game from clipboard! =
Start game! =
@ -553,14 +295,6 @@ Large =
Huge =
Difficulty =
Settler =
Chieftain =
Warlord =
Prince =
King =
Emperor =
Immortal =
Deity =
AI =
Remove =
@ -598,11 +332,7 @@ Set current user =
Player ID from clipboard =
To create a multiplayer game, check the 'multiplayer' toggle in the New Game screen, and for each human player insert that player's user ID. =
You can assign your own user ID there easily, and other players can copy their user IDs here and send them to you for you to include them in the game. =
#Depricated
Once you've created your game, enter this screen again to copy the Game ID and send it to the other players. =
Once you've created your game, the Game ID gets automatically copied to your clipboard so you can send it to the other players. =
#Depricated
Players can enter your game by copying the game ID to the clipboard, and clicking on the Join Game button =
Players can enter your game by copying the game ID to the clipboard, and clicking on the 'Add Multiplayer Game' button =
The symbol of your nation will appear next to the game when it's your turn =
Back =
@ -783,7 +513,6 @@ Start Golden Age =
Yes =
No =
Acquire =
Gold =
Science =
Happiness =
Production =
@ -1050,289 +779,11 @@ Free for [units] =
Adopt policy =
Adopt free policy =
Unlocked at =
Tradition =
+3 culture in capital and increased rate of border expansion =
Aristocracy =
+15% production when constructing wonders, +1 happiness for every 10 citizens in a city =
Legalism =
Immediately creates a cheapest available cultural building in each of your first 4 cities for free =
Oligarchy =
Units in cities cost no Maintenance, garrisoned city +50% attacking strength =
Landed Elite =
+10% food growth and +2 food in capital =
Monarchy =
+1 gold and -1 unhappiness for every 2 citizens in capital =
Tradition Complete =
+15% growth and +2 food in all cities =
Liberty =
+1 culture in every city =
Collective Rule =
Training of settlers increased +50% in capital, receive a new settler near the capital =
Citizenship =
Tile improvement speed +25%, receive a free worker near the capital =
Republic =
+1 construction in every city, +5% construction when constructing buildings =
Representation =
Each city founded increases culture cost of policies 33% less than normal. Starts a golden age. =
Meritocracy =
+1 happiness for every city connected to capital, -5% unhappiness from citizens =
Liberty Complete =
Free Great Person of choice near capital =
Honor =
+25% bonus vs Barbarians; gain Culture when you kill a barbarian unit =
Warrior Code =
+20% production when training melee units =
Discipline =
+15% combat strength for melee units which have another military unit in an adjacent tile =
Military Tradition =
Military units gain 50% more Experience from combat =
Military Caste =
Each city with a garrison increases happiness by 1 and culture by 2 =
Professional Army =
Honor Complete =
Gain gold for each unit killed =
Piety =
Building time of culture buildings reduced by 15% =
Organized Religion =
+1 happiness for each monument, temple and monastery =
Mandate Of Heaven =
50% of excess happiness added to culture towards policies =
Theocracy =
Temples give +10% gold =
Reformation =
+33% culture in all cities with a world wonder, immediately enter a golden age =
Free Religion =
+1 culture for each monument, temple and monastery. Gain a free policy. =
Piety Complete =
Reduce culture cost of future policies by 10% =
Commerce =
+25% gold in capital =
Trade Unions =
Maintenance on roads & railroads reduced by 33%, +2 gold from all trade routes =
Mercantilism =
-25% to purchasing items in cities =
Entrepreneurship =
Great Merchants are earned 25% faster, +1 Science from every Mint, Market, Bank and Stock Exchange. =
Patronage =
Cost of purchasing culture buildings reduced by 50% =
Protectionism =
+1 happiness from each luxury resource =
Commerce Complete =
+1 gold from every trading post, double gold from Great Merchant trade missions =
Rationalism =
Production to science conversion in cities increased by 33% =
Secularism =
+2 science from every specialist =
Humanism =
+1 happiness from every university, observatory and public school =
Free Thought =
+1 science from every trading post, +17% science from universities =
Sovereignty =
+15% science while empire is happy =
Scientific Revolution =
Gain 2 free technologies =
Rationalism Complete =
+1 gold from all science buildings =
Freedom =
+25% great people rate =
Constitution =
+2 culture from each wonder =
Universal Suffrage =
+1 production per 5 population =
Civil Society =
-50% food consumption by specialists =
Free Speech =
+1 culture for every 2 citizens =
Democracy =
Specialists produce half normal unhappiness =
Freedom Complete =
Tile yield from great improvement +100%, golden ages increase by 50% =
Autocracy =
-33% unit upkeep costs =
Populism =
Wounded military units deal +25% damage =
Militarism =
Gold cost of purchasing units -33% =
Fascism =
Quantity of strategic resources produced by the empire increased by 100% =
Police State =
+3 Happiness from every Courthouse. Build Courthouses in half the usual time. =
Total War =
+15% production when building military units and new military units start with 15 Experience =
Autocracy Complete =
+20% attack bonus to all Military Units for 30 turns =
# Technologies
Agriculture =
'Where tillage begins, other arts follow. The farmers therefore are the founders of human civilization.' - Daniel Webster =
Pottery =
'Shall the clay say to him that fashioneth it, what makest thou?' - Bible Isaiah 45:9 =
Animal Husbandry =
'Thou shalt not muzzle the ox when he treadeth out the corn.' - Bible Deuteronomy 25:4 =
Archery =
'The haft of the arrow has been feathered with one of the eagle's own plumes, we often give our enemies the means of our own destruction' - Aesop =
Mining =
'The meek shall inherit the Earth, but not its mineral rights.' - J. Paul Getty =
Sailing =
'He who commands the sea has command of everything.' - Themistocles =
Calendar =
'So teach us to number our days, so that we may apply our hearts unto wisdom.' - Bible Psalms 90:12 =
Writing =
'He who destroys a good book kills reason itself.' - John Milton =
Trapping =
'Even brute beasts and wandering birds do not fall into the same traps or nets twice.' - Saint Jerome =
The Wheel =
'Wisdom and virtue are like the two wheels of a cart.' - Japanese proverb =
Masonry =
'How happy are those whose walls already rise!' - Virgil =
Bronze Working =
'Here Hector entered, with a spear eleven cubits long in his hand; the bronze point gleamed in front of him, and was fastened to the shaft of the spear by a ring of gold.' - Homer =
Optics =
'He made an instrument to know if the moon shine at full or no.' - Samuel Butler =
Horseback Riding =
'A Horse! A Horse! My kingdom for a horse!' - Shakespeare (Richard III) =
Mathematics =
'Mathematics is the gate and key to the sciences.' - Roger Bacon =
Construction =
'Three things are to be looked to in a building: that it stands on the right spot; that it be securely founded; that it be successfully executed.' - Johann Wolfgang von Goethe =
Philosophy =
'There is only one good, knowledge, and one evil, ignorance.' - Socrates =
Currency =
'Better is bread with a happy heart than wealth with vexation.' - Amenemope =
Engineering =
'Instrumental or mechanical science is the noblest and, above all others, the most useful.' - Leonardo da Vinci =
Iron Working =
'Do not wait to strike til the iron is hot, but make it hot by striking.' - William Butler Yeats =
Theology =
'Three things are necessary for the salvation of man: to know what he ought to believe; to know what he ought to desire; and to know what he ought to do' - St. Thomas Aquinas =
Civil Service =
'The only thing that saves us from the bureaucracy is it inefficiency' - Eugene McCarthy =
Enables Open Borders agreements =
Guilds =
'The merchants and the traders have come; their profits are pre-ordained...' - Sri Guru Granth Sahib =
Physics =
'Measure what is measurable, and make measurable what is not so.' - Galileo Galilei =
Metal Casting =
'When pieces of bronze or gold or iron break, the metal-smith welds them together again in the fire, and the bond is established.' - Sri Guru Granth Sahib =
Steel =
'John Henry said to his Captain, / 'A man ain't nothin' but a man, / And before I'll let your steam drill beat me down, / I'll die with the hammer in my hand.'' - Anonymous: The Ballad of John Henry, the Steel-Drivin' Man =
Compass =
'I find the great thing in this world is not so much where we stand, as in what direction we are moving.' - Oliver Wendell Holmes =
Education =
'Education is the best provision for old age.' - Aristotle =
Chivalry =
'Whoso pulleth out this sword of this stone and anvil, is rightwise king born of all England.' - Malory =
Machinery =
'The press is the best instrument for enlightening the mind of man, and improving him as a rational, moral and social being.' - Thomas Jefferson =
Astronomy =
'Joyfully to the breeze royal Odysseus spread his sail, and with his rudder skillfully he steered.' - Homer =
Acoustics =
'Their rising all at once was as the sound of thunder heard remote' - Milton =
Banking =
'Happiness: a good bank account, a good cook and a good digestion' - Jean Jacques Rousseau =
Printing Press =
'It is a newspaper's duty to print the news and raise hell.' - The Chicago Times =
Gunpowder =
'The day when two army corps can annihilate each other in one second, all civilized nations, it is to be hoped, will recoil from war and discharge their troops.' - Alfred Nobel =
Navigation =
'The winds and the waves are always on the side of the ablest navigators.' - Edward Gibbon =
Architecture =
'Architecture begins where engineering ends.' - Walter Gropius =
Economics =
'Compound interest is the most powerful force in the universe.' - Albert Einstein =
Metallurgy =
'There never was a good knife made of bad steel.' - Benjamin Franklin =
Chemistry =
'Wherever we look, the work of the chemist has raised the level of our civilization and has increased the productive capacity of the nation.' - Calvin Coolidge =
Scientific Theory =
'Every great advance in science has issued from a new audacity of imagination.' - John Dewey =
Archaeology =
'Those who cannot remember the past are condemned to repeat it.' - George Santayana =
Industrialization =
'Industrialization based on machinery, already referred to as a characteristic of our age, is but one aspect of the revolution that is being wrought by technology.' - Emily Greene Balch =
Rifling =
'It is well that war is so terrible, or we should grow too fond of it.' - Robert E. Lee =
Military Science =
'Wars may be fought with weapons, but they are won by men. It is the spirit of the men who follow and of the man who leads that gains the victory.' - George S. Patton =
Fertilizer =
'The nation that destroys its soil destroys itself.' - Franklin Delano Roosevelt =
Biology =
'If the brain were so simple we could understand it, we would be so simple we couldn't.' - Lyall Watson =
Electricity =
'Is it a fact - or have I dreamt it - that, by means of electricity, the world of matter has become a great nerve, vibrating thousands of miles in a breathless point of time?' - Nathaniel Hawthorne =
Steam Power =
'The nations of the West hope that by means of steam communication all the world will become as one family.' - Townsend Harris =
Dynamite =
'As soon as men decide that all means are permitted to fight an evil, then their good becomes indistinguishable from the evil that they set out to destroy.' - Christopher Dawson =
Refrigeration =
'And homeless near a thousand homes I stood, and near a thousand tables pined and wanted food.' - William Wordsworth =
Replaceable Parts =
'Nothing is particularly hard if you divide it into small jobs.' - Henry Ford =
Radio =
'The whole country was tied together by radio. We all experienced the same heroes and comedians and singers. They were giants.' - Woody Allen =
Combustion =
'Any man who can drive safely while kissing a pretty girl is simply not giving the kiss the attention it deserves.' - Albert Einstein =
Plastics =
'Ben, I want to say one word to you, just one word: plastics.' - Buck Henry and Calder Willingham, The Graduate =
Electronics =
'There's a basic principle about consumer electronics: it gets more powerful all the time and it gets cheaper all the time.' - Trip Hawkins =
Ballistics =
'Men, like bullets, go farthest when they are smoothest.' - Jean Paul =
Mass Media =
Flight =
'Aeronautics was neither an industry nor a science. It was a miracle.' - Igor Sikorsky =
'The introduction of so powerful an agent as steam to a carriage on wheels will make a great change in the situation of man.' - Thomas Jefferson =
Pharmaceuticals =
'In nothing do men more nearly approach the gods than in giving health to men.' - Cicero =
Radar =
'Vision is the art of seeing things invisible.' - Jonathan Swift =
Atomic Theory =
'The unleashed power of the atom has changed everything save our modes of thinking, and we thus drift toward unparalleled catastrophes.' - Albert Einstein =
Computers =
'Computers are like Old Testament gods: lots of rules and no mercy.' - Joseph Campbell =
Mobile Tactics =
'All men can see these tactics whereby I conquer, but what none can see is the strategy out of which victory is evolved.' - Sun Tzu =
Combined Arms =
'The root of the evil is not the construction of new, more dreadful weapons. It is the spirit of conquest.' - Ludwig von Mises =
Nuclear Fission =
'I am become Death, the destroyer of worlds.' - J. Robert Oppenheimer =
Ecology =
'Only within the moment of time represented by the present century has one species, man, acquired significant power to alter the nature of his world.' - Rachel Carson =
Rocketry =
'A good rule for rocket experimenters to follow is this: always assume that it will explode.' - Astronautics Magazine, 1937 =
Robotics =
'1. A robot may not injure a human being or, through inaction, allow a human being to come to harm. 2. A robot must obey any orders given to it by human beings, except when such orders would conflict with the First Law. 3. A robot must protect its own existence as long as such protection does not conflict with the First or Second Law.' - Isaac Asimov =
Lasers =
'The night is far spent, the day is at hand: let us therefore cast off the works of darkness, and let us put on the armor of light.' - The Holy Bible: Romans, 13:12 =
Nanotechnology =
'The impact of nanotechnology is expected to exceed the impact that the electronics revolution has had on our lives.' - Richard Schwartz =
Satellites =
'Now, somehow, in some new way, the sky seemed almost alien.' - Lyndon B. Johnson =
Particle Physics =
'Every particle of matter is attracted by or gravitates to every other particle of matter with a force inversely proportional to the squares of their distances.' - Isaac Newton =
Future Tech =
'I think we agree, the past is over.' - George W. Bush =
# Technology uniques
Who knows what the future holds? =
+10% science and production in all cities =
Improves movement speed on roads =
Enables conversion of city production to science =
Enables Research agreements =
Enables conversion of city production to gold =
Enables embarkation for land units =
Enables embarked units to enter ocean tiles =
Increases embarked movement +1 =
# Tech eras
@ -1347,112 +798,17 @@ Future era =
# Terrains
Grassland =
Plains =
Tundra =
Desert =
Lakes =
Hill =
Mountain =
Forest =
Jungle =
Marsh =
Fallout =
Oasis =
Snow =
Coast =
Ocean =
Flood plains =
Impassible =
Atoll =
Ice =
# Natural Wonders
Barringer Crater =
Grand Mesa =
Great Barrier Reef =
Krakatoa =
Mount Fuji =
Old Faithful =
Rock of Gibraltar =
Cerro de Potosi =
El Dorado =
Fountain of Youth =
# Natural Wonders Uniques
Grants 500 Gold to the first civilization to discover it =
Grants Rejuvenation (all healing effects doubled) to adjacent military land units for the rest of the game =
# Resources
Cattle =
Sheep =
Deer =
Bananas =
Wheat =
Stone =
Fish =
Bison =
Horses =
Iron =
Coal =
Oil =
Aluminum =
Uranium =
Furs =
Cotton =
Dyes =
Gems =
Silver =
Incense =
Ivory =
Silk =
Spices =
Wine =
Sugar =
Marble =
+15% production towards Wonder construction =
Pearls =
Whales =
Copper =
Cocoa =
Crab =
Citrus =
Truffles =
# Improvements
Farm =
Lumber mill =
Mine =
Trading post =
Camp =
Oil well =
Pasture =
Plantation =
Quarry =
Fishing Boats =
Road =
Remove Road =
Railroad =
Remove Railroad =
Remove Forest =
Remove Jungle =
Remove Marsh =
Remove Fallout =
Ancient ruins =
City ruins =
Academy =
Landmark =
Manufactory =
Customs house =
Moai =
+1 additional Culture for each adjacent Moai =
Can only be built on Coastal tiles =
Barbarian encampment =
# Unit types
Civilian =
@ -1465,9 +821,7 @@ WaterMelee =
Ranged =
WaterRanged =
WaterSubmarine =
Siege =
Mounted =
Scout =
Armor =
City =
Missile =
@ -1476,245 +830,32 @@ WaterMissileCarrier =
# Units
Founds a new city =
Worker =
Can build improvements on tiles =
Ignores terrain cost =
Brute =
Warrior =
Maori Warrior =
Archer =
Bowman =
Work Boats =
Cannot enter ocean tiles until Astronomy =
May create improvements on water resources =
Trireme =
Cannot enter ocean tiles =
Chariot Archer =
No defensive terrain bonus =
Rough terrain penalty =
War Chariot =
Spearman =
Hoplite =
Persian Immortal =
+10 HP when healing =
Composite Bowman =
Catapult =
Must set up to ranged attack =
Ballista =
Swordsman =
Mohawk Warrior =
+33% combat bonus in Forest/Jungle =
Legion =
Can construct roads =
Horseman =
Can move after attacking =
Companion Cavalry =
War Elephant =
Galleass =
Crossbowman =
Longbowman =
Chu-Ko-Nu =
Logistics =
1 additional attack per turn =
Trebuchet =
Hwach'a =
Limited Visibility =
Longswordsman =
Pikeman =
Landsknecht =
Knight =
Camel Archer =
Conquistador =
Mandekalu Cavalry =
Defense bonus when embarked =
Keshik =
50% Bonus XP gain =
Naresuan's Elephant =
Samurai =
Combat very likely to create Great Generals =
Caravel =
Turtle Ship =
+1 Visibility Range =
+2 Visibility Range =
Cannon =
Musketman =
Musketeer =
Janissary =
Tercio =
Heals [amountHealed] damage if it kills a unit =
Minuteman =
Frigate =
Ship of the Line =
Lancer =
Sipahi =
No movement cost to pillage =
Gatling Gun =
Rifleman =
Cavalry =
Cossack =
Artillery =
Indirect Fire =
Ironclad =
Double movement in coast =
Landship =
Great War Infantry =
Foreign Legion =
+20% bonus outside friendly territory =
Foreign Land =
Destroyer =
Can attack submarines =
Machine Gun =
Anti-Aircraft Gun =
Infantry =
Battleship =
Submarine =
Bonus as Attacker [amount]% =
Invisible to others =
Can only attack water =
Can enter ice tiles =
Carrier =
Triplane =
[percent]% chance to intercept air attacks =
Requires Manhattan Project =
6 tiles in every direction always visible =
Great War Bomber =
Rocket Artillery =
Anti-Tank Gun =
Marine =
Mobile SAM =
Paratrooper =
Tank =
Panzer =
Bomber =
Mechanized Infantry =
Modern Armor =
B17 =
Fighter =
Zero =
Helicopter Gunship =
Atomic Bomb =
Nuclear Missile =
Great Artist =
Unbuildable =
Can start an 8-turn golden age =
Can build improvement: Landmark =
Great Scientist =
Can hurry technology research =
Can build improvement: Academy =
Great Merchant =
Can undertake a trade mission with City-State, giving a large sum of gold and [influenceAmount] Influence =
Can build improvement: Customs house =
Great Engineer =
Can speed up construction of a wonder =
Can build improvement: Manufactory =
Great General =
Bonus for units in 2 tile radius 15% =
Khan =
Heal adjacent units for an additional 15 HP per turn =
# Promotions
Pick promotion =
OR =
Bonus vs [unitType] =
Penalty vs [unitType] =
Accuracy I =
Accuracy II =
Accuracy III =
units in open terrain =
units in rough terrain =
Barrage I =
Barrage II =
Barrage III =
Shock I =
Shock II =
Shock III =
Drill I =
Drill II =
Drill III =
Scouting I =
Scouting II =
Scouting III =
+1 Movement =
Cover I =
Cover II =
+25% Defence against ranged attacks =
March =
Charge =
wounded units =
Mobility =
Volley =
Sentry =
Extended Range =
+1 Range =
Ranged attacks may be performed over obstacles =
Formation I =
Formation II =
Blitz =
Bombardment I =
Bombardment II =
Bombardment III =
Boarding Party I =
Boarding Party II =
Boarding Party III =
Coastal Raider I =
Coastal Raider II =
Coastal Raider III =
Targeting I =
Targeting II =
Targeting III =
Wolfpack I =
Wolfpack II =
Wolfpack III =
Woodsman =
Double movement rate through Forest and Jungle =
Heal Instantly =
Heal this Unit by 50 HP; Doing so will consume this opportunity to choose a Promotion =
Medic =
Medic II =
This unit and all others in adjacent tiles heal 5 additional HP per turn =
This unit and all others in adjacent tiles heal 5 additional HP. This unit heals 5 additional HP outside of friendly territory. =
Targeting I (air) =
Targeting II (air) =
Targeting III (air) =
Air Repair =
Unit will heal every turn, even if it performs an action =
Operational Range =
+2 Range =
Sortie =
1 extra Interception may be made per turn =
Bonus when performing air sweep [bonusAmount]% =
Dogfighting I =
Dogfighting II =
Dogfighting III =
Bonus when intercepting [bonusAmount]% =
Interception I =
Interception II =
Interception III =
Siege I =
Siege II =
Siege III =
Evasion =
Reduces damage taken from interception by 50% =
Bonus when intercepting [amount]% =
Ambush I =
Ambush II =
Armor Plating I =
Armor Plating II =
Armor Plating III =
+25% Combat Bonus when defending =
Flight Deck I =
Flight Deck II =
Flight Deck III =
Can carry 1 extra air unit =
Can carry 2 aircraft =
Haka War Dance =
-10% combat strength for adjacent enemy units =
Rejuvenation =
All healing effects doubled =
# Multiplayer Turn Checker Service
Multiplayer options =
Enable out-of-game turn notifications =
Time between turn checks out-of-game (in minutes) =
Show persistent notification for turn notifier service =
Show persistent notification for turn notifier service =

View file

@ -14,7 +14,7 @@ import com.unciv.logic.map.MapParameters
import com.unciv.models.metadata.GameParameters
import com.unciv.models.metadata.GameSettings
import com.unciv.models.ruleset.RulesetCache
import com.unciv.models.translations.TranslationFileReader
import com.unciv.models.translations.TranslationFileWriter
import com.unciv.models.translations.Translations
import com.unciv.ui.LanguagePickerScreen
import com.unciv.ui.utils.*
@ -81,7 +81,7 @@ class UncivGame(
if (rewriteTranslationFiles) { // Yes, also when running from the Jar. Sue me.
translations.readAllLanguagesTranslation()
TranslationFileReader.writeNewTranslationFiles(translations)
TranslationFileWriter.writeNewTranslationFiles(translations)
} else {
translations.tryReadTranslationForCurrentLanguage()
}

View file

@ -138,7 +138,7 @@ object Battle {
if (defender.isDefeated()
&& defender is MapUnitCombatant
&& attacker is MapUnitCombatant) {
val regex = Regex("""Heals \[(\d*)\] damage if it kills a unit""")
val regex = Regex(BattleDamage.HEAL_WHEN_KILL)
for (unique in attacker.unit.getUniques()) {
val match = regex.matchEntire(unique)
if (match == null) continue

View file

@ -18,11 +18,17 @@ class BattleDamageModifier(val vs:String,val modificationAmount:Float){
class BattleDamage{
companion object {
const val BONUS_VS_UNIT_TYPE = """(Bonus|Penalty) vs (.*) (\d*)%"""
const val BONUS_AS_ATTACKER = """Bonus as Attacker \[(\d*)]%"""
const val HEAL_WHEN_KILL = """Heals \[(\d*)] damage if it kills a unit"""
}
private fun getBattleDamageModifiersOfUnit(unit:MapUnit): MutableList<BattleDamageModifier> {
val modifiers = mutableListOf<BattleDamageModifier>()
for (ability in unit.getUniques()) {
// This beut allows us to have generic unit uniques: "Bonus vs City 75%", "Penatly vs Mounted 25%" etc.
val regexResult = Regex("""(Bonus|Penalty) vs (.*) (\d*)%""").matchEntire(ability)
val regexResult = Regex(BONUS_VS_UNIT_TYPE).matchEntire(ability)
if (regexResult == null) continue
val vs = regexResult.groups[2]!!.value
val modificationAmount = regexResult.groups[3]!!.value.toFloat() / 100 // if it says 15%, that's 0.15f in modification
@ -113,7 +119,7 @@ class BattleDamage{
modifiers.putAll(getTileSpecificModifiers(attacker,defender.getTile()))
for (ability in attacker.unit.getUniques()) {
val regexResult = Regex("""Bonus as Attacker [(\d*)]%""").matchEntire(ability) //to do: extend to defender, and penalyy
val regexResult = Regex(BONUS_AS_ATTACKER).matchEntire(ability) //to do: extend to defender, and penalyy
if (regexResult == null) continue
val bonus = regexResult.groups[1]!!.value.toFloat() / 100
if (modifiers.containsKey("Attacker Bonus"))

View file

@ -70,6 +70,8 @@ class MapUnit {
private const val ANCIENT_RUIN_MAP_REVEAL_OFFSET = 4
private const val ANCIENT_RUIN_MAP_REVEAL_RANGE = 4
private const val ANCIENT_RUIN_MAP_REVEAL_CHANCE = 0.8f
const val BONUS_WHEN_INTERCEPTING = "Bonus when intercepting"
const val CHANCE_TO_INTERCEPT_AIR_ATTACKS = " chance to intercept air attacks"
}
//region pure functions
@ -624,7 +626,7 @@ class MapUnit {
fun interceptChance():Int{
val interceptUnique = getUniques()
.firstOrNull { it.endsWith(" chance to intercept air attacks") }
.firstOrNull { it.endsWith(CHANCE_TO_INTERCEPT_AIR_ATTACKS) }
if(interceptUnique==null) return 0
val percent = Regex("\\d+").find(interceptUnique)!!.value.toInt()
return percent
@ -651,7 +653,7 @@ class MapUnit {
fun interceptDamagePercentBonus():Int{
var sum=0
for(unique in getUniques().filter { it.startsWith("Bonus when intercepting") }){
for(unique in getUniques().filter { it.startsWith(BONUS_WHEN_INTERCEPTING) }){
val percent = Regex("\\d+").find(unique)!!.value.toInt()
sum += percent
}

View file

@ -1,17 +1,13 @@
package com.unciv.models.translations
import com.badlogic.gdx.Gdx
import com.unciv.JsonParser
import com.unciv.models.ruleset.Nation
import java.nio.charset.Charset
import kotlin.collections.set
import com.badlogic.gdx.utils.Array
object TranslationFileReader {
private const val percentagesFileLocation = "jsons/translations/completionPercentages.properties"
const val templateFileLocation = "jsons/translations/template.properties"
private val charset = Charset.forName("UTF-8").name()
const val percentagesFileLocation = "jsons/translations/completionPercentages.properties"
val charset: String = Charset.forName("UTF-8").name()
fun read(translationFile: String): LinkedHashMap<String, String> {
val translations = LinkedHashMap<String, String>()
@ -28,58 +24,6 @@ object TranslationFileReader {
return translations
}
private fun writeByTemplate(language:String, translations: HashMap<String, String>){
val templateFile = Gdx.files.internal(templateFileLocation)
val linesFromTemplates = mutableListOf<String>()
linesFromTemplates.addAll(templateFile.reader().readLines())
linesFromTemplates.add("\n#################### Lines from Nations.json ####################\n")
linesFromTemplates.addAll(generateNationsStrings())
linesFromTemplates.add("\n#################### Lines from Tutorials.json ####################\n")
linesFromTemplates.addAll(generateTutorialsStrings())
val stringBuilder = StringBuilder()
for(line in linesFromTemplates){
if(!line.contains(" = ")){ // copy as-is
stringBuilder.appendln(line)
continue
}
val translationKey = line.split(" = ")[0].replace("\\n","\n")
var translationValue = ""
if(translations.containsKey(translationKey)) translationValue = translations[translationKey]!!
else stringBuilder.appendln(" # Requires translation!")
val lineToWrite = translationKey.replace("\n","\\n") +
" = "+ translationValue.replace("\n","\\n")
stringBuilder.appendln(lineToWrite)
}
Gdx.files.local("jsons/translations/$language.properties")
.writeString(stringBuilder.toString(),false,charset)
}
fun writeNewTranslationFiles(translations: Translations) {
for (language in translations.getLanguages()) {
val languageHashmap = HashMap<String, String>()
for (translation in translations.values) {
if (translation.containsKey(language))
languageHashmap[translation.entry] = translation[language]!!
}
writeByTemplate(language, languageHashmap)
}
writeLanguagePercentages(translations)
}
private fun writeLanguagePercentages(translations: Translations){
val percentages = translations.calculatePercentageCompleteOfLanguages()
val stringBuilder = StringBuilder()
for(entry in percentages){
stringBuilder.appendln(entry.key+" = "+entry.value)
}
Gdx.files.local(percentagesFileLocation).writeString(stringBuilder.toString(),false)
}
fun readLanguagePercentages():HashMap<String,Int>{
val hashmap = HashMap<String,Int>()
@ -92,40 +36,4 @@ object TranslationFileReader {
return hashmap
}
fun generateNationsStrings(): Collection<String> {
val nations = JsonParser().getFromJson(emptyArray<Nation>().javaClass, "jsons/Nations.json")
val strings = mutableSetOf<String>() // using set to avoid duplicates
for (nation in nations) {
for (field in nation.javaClass.declaredFields
.filter { it.type == String::class.java || it.type == java.util.ArrayList::class.java }) {
field.isAccessible = true
val fieldValue = field.get(nation)
if (field.name != "startBias" && // skip fields which must not be translated
fieldValue != null && fieldValue != "") {
if (fieldValue is ArrayList<*>) {
for (item in fieldValue)
strings.add("$item = ")
} else
strings.add("$fieldValue = ")
}
}
}
return strings
}
fun generateTutorialsStrings(): Collection<String> {
val tutorials = JsonParser().getFromJson(LinkedHashMap<String, Array<String>>().javaClass, "jsons/Tutorials.json")
val strings = mutableSetOf<String>() // using set to avoid duplicates
for (tutorial in tutorials) {
for (str in tutorial.value)
if (str != "") strings.add("$str = ")
}
return strings
}
}

View file

@ -0,0 +1,199 @@
package com.unciv.models.translations
import com.badlogic.gdx.Gdx
import com.badlogic.gdx.utils.Array
import com.unciv.JsonParser
import com.unciv.logic.battle.BattleDamage
import com.unciv.logic.map.MapUnit
import com.unciv.models.ruleset.*
import com.unciv.models.ruleset.tech.TechColumn
import com.unciv.models.ruleset.tile.Terrain
import com.unciv.models.ruleset.tile.TileImprovement
import com.unciv.models.ruleset.tile.TileResource
import com.unciv.models.ruleset.unit.BaseUnit
import com.unciv.models.ruleset.unit.Promotion
import com.unciv.ui.worldscreen.unit.UnitActions
import java.lang.reflect.Field
object TranslationFileWriter {
const val templateFileLocation = "jsons/translations/template.properties"
private val generatedStrings = mutableMapOf<String,MutableSet<String>>()
private fun writeByTemplate(language:String, translations: HashMap<String, String>){
val templateFile = Gdx.files.internal(templateFileLocation)
val linesFromTemplates = mutableListOf<String>()
linesFromTemplates.addAll(templateFile.reader().readLines())
generateStringsFromJSONs()
for (key in generatedStrings.keys) {
linesFromTemplates.add("\n#################### Lines from $key.json ####################\n")
linesFromTemplates.addAll(generatedStrings.getValue(key))
}
val stringBuilder = StringBuilder()
for(line in linesFromTemplates){
if(!line.contains(" = ")){ // copy as-is
stringBuilder.appendln(line)
continue
}
val translationKey = line.split(" = ")[0].replace("\\n","\n")
var translationValue = ""
if(translations.containsKey(translationKey)) translationValue = translations[translationKey]!!
else stringBuilder.appendln(" # Requires translation!")
val lineToWrite = translationKey.replace("\n","\\n") +
" = "+ translationValue.replace("\n","\\n")
stringBuilder.appendln(lineToWrite)
}
Gdx.files.local("jsons/translations/$language.properties")
.writeString(stringBuilder.toString(),false, TranslationFileReader.charset)
}
fun writeNewTranslationFiles(translations: Translations) {
for (language in translations.getLanguages()) {
val languageHashmap = HashMap<String, String>()
for (translation in translations.values) {
if (translation.containsKey(language))
languageHashmap[translation.entry] = translation[language]!!
}
writeByTemplate(language, languageHashmap)
}
writeLanguagePercentages(translations)
}
private fun writeLanguagePercentages(translations: Translations){
val percentages = translations.calculatePercentageCompleteOfLanguages()
val stringBuilder = StringBuilder()
for(entry in percentages){
stringBuilder.appendln(entry.key+" = "+entry.value)
}
Gdx.files.local(TranslationFileReader.percentagesFileLocation).writeString(stringBuilder.toString(),false)
}
private fun generateTutorialsStrings(): Collection<String> {
if (generatedStrings.containsKey("Tutorials"))
return generatedStrings.getValue("Tutorials")
generatedStrings["Tutorials"] = mutableSetOf()
val tutorialsStrings = generatedStrings["Tutorials"]
val tutorials = JsonParser().getFromJson(LinkedHashMap<String, Array<String>>().javaClass, "jsons/Tutorials.json")
for (tutorial in tutorials) {
for (str in tutorial.value)
if (str != "") tutorialsStrings!!.add("$str = ")
}
return tutorialsStrings!!
}
fun getGeneratedStringsSize(): Int {
if (generatedStrings.isEmpty())
generateStringsFromJSONs()
return generatedStrings.values.sumBy { it.size }
}
private fun generateStringsFromJSONs() {
if (generatedStrings.isNotEmpty())
return // do not regenerate if the strings are ready
val jsonParser = JsonParser()
val folderHandler = Gdx.files.internal("jsons")
val listOfJSONFiles = folderHandler.list{file -> file.name.endsWith(".json", true)}
for (jsonFile in listOfJSONFiles)
{
val filename = jsonFile.nameWithoutExtension()
// Tutorials are a bit special
if (filename == "Tutorials") {
generateTutorialsStrings()
continue
}
val javaClass = getJavaClassByName(filename)
if (javaClass == this.javaClass)
continue // unknown JSON, let's skip it
val array = jsonParser.getFromJson(javaClass, jsonFile.path())
generatedStrings[filename] = mutableSetOf()
val resultStrings = generatedStrings[filename]
fun submitString(item: Any) {
val string = item.toString()
// substitute the regex for "Bonus/Penalty vs ..."
val match = Regex(BattleDamage.BONUS_VS_UNIT_TYPE).matchEntire(string)
when {
match != null ->
resultStrings!!.add("${match.groupValues[1]} vs [unitType] = ")
// substitute the regex for the bonuses, etc.
string.startsWith(MapUnit.BONUS_WHEN_INTERCEPTING)
|| string.startsWith(UnitActions.CAN_UNDERTAKE)
|| string.endsWith(MapUnit.CHANCE_TO_INTERCEPT_AIR_ATTACKS)
|| Regex(BattleDamage.BONUS_AS_ATTACKER).matchEntire(string) != null
|| Regex(BattleDamage.HEAL_WHEN_KILL).matchEntire(string) != null ->
{
val updatedString = string.replace("\\[\\d+(?=])]".toRegex(),"[amount]")
resultStrings!!.add("$updatedString = ")
}
else ->
resultStrings!!.add("$string = ")
}
}
fun serializeElement(element: Any) {
val allFields = (element.javaClass.declaredFields + element.javaClass.fields).
filter { it.type == String::class.java ||
it.type == java.util.ArrayList::class.java ||
it.type == java.util.HashSet::class.java }
for (field in allFields) {
field.isAccessible = true
val fieldValue = field.get(element)
if (isFieldTranslatable(field, fieldValue)) { // skip fields which must not be translated
// this field can contain sub-objects, let's serialize them as well
if (fieldValue is java.util.AbstractCollection<*>) {
for (item in fieldValue)
if (item is String) submitString(item) else serializeElement(item!!)
} else
submitString(fieldValue)
}
}
}
if (array is kotlin.Array<*>)
for (element in array)
serializeElement(element!!) // let's serialize the strings recursively
}
}
private fun isFieldTranslatable(field: Field, fieldValue: Any?): Boolean {
return fieldValue != null &&
fieldValue != "" &&
field.name !in setOf("startBias", "requiredTech", "uniqueTo",
"aiFreeTechs", "aiFreeUnits", "techRequired", "improvingTech", "promotions",
"building", "revealedBy", "attackSound", "requiredResource", "obsoleteTech")
}
private fun getJavaClassByName(name: String): Class<Any> {
return when (name) {
"Buildings" -> emptyArray<Building>().javaClass
"Difficulties" -> emptyArray<Difficulty>().javaClass
"GreatPeopleNames" -> this.javaClass // dummy value
"Nations" -> emptyArray<Nation>().javaClass
"Policies" -> emptyArray<PolicyBranch>().javaClass
"Techs" -> emptyArray<TechColumn>().javaClass
"Terrains" -> emptyArray<Terrain>().javaClass
"TileImprovements" -> emptyArray<TileImprovement>().javaClass
"TileResources" -> emptyArray<TileResource>().javaClass
"Tutorials" -> this.javaClass // dummy value
"UnitPromotions" -> emptyArray<Promotion>().javaClass
"Units" -> emptyArray<BaseUnit>().javaClass
else -> this.javaClass // dummy value
}
}
}

View file

@ -1,9 +1,7 @@
package com.unciv.models.translations
import com.badlogic.gdx.Gdx
import com.unciv.JsonParser
import com.unciv.UncivGame
import com.unciv.models.ruleset.Nation
import java.util.*
import kotlin.collections.HashMap
@ -120,9 +118,8 @@ class Translations : LinkedHashMap<String, TranslationEntry>(){
val percentComplete = HashMap<String,Int>()
val translationStart = System.currentTimeMillis()
var allTranslations = TranslationFileReader.generateNationsStrings().size
allTranslations += TranslationFileReader.generateTutorialsStrings().size
Gdx.files.internal(TranslationFileReader.templateFileLocation)
var allTranslations = TranslationFileWriter.getGeneratedStringsSize()
Gdx.files.internal(TranslationFileWriter.templateFileLocation)
.reader().forEachLine { if(it.contains(" = ")) allTranslations+=1 }
for(language in getLanguagesWithTranslationFile()){

View file

@ -20,6 +20,8 @@ import com.unciv.ui.worldscreen.WorldScreen
object UnitActions {
const val CAN_UNDERTAKE = "Can undertake"
fun getUnitActions(unit: MapUnit, worldScreen: WorldScreen): List<UnitAction> {
val tile = unit.getTile()
val unitTable = worldScreen.bottomUnitTable
@ -321,7 +323,7 @@ object UnitActions {
if (unit.civInfo.policies.isAdopted("Commerce Complete"))
goldEarned *= 2
unit.civInfo.gold += goldEarned.toInt()
val relevantUnique = unit.getUniques().first { it.startsWith("Can undertake") }
val relevantUnique = unit.getUniques().first { it.startsWith(CAN_UNDERTAKE) }
val influenceEarned = Regex("\\d+").find(relevantUnique)!!.value.toInt()
tile.owningCity!!.civInfo.getDiplomacyManager(unit.civInfo).influence += influenceEarned
unit.civInfo.addNotification("Your trade mission to [${tile.owningCity!!.civInfo}] has earned you [${goldEarned.toInt()}] gold and [$influenceEarned] influence!", null, Color.GOLD)

View file

@ -2,13 +2,10 @@
package com.unciv.testing
import com.badlogic.gdx.Gdx
import com.badlogic.gdx.utils.Array
import com.unciv.JsonParser
import com.unciv.models.UnitActionType
import com.unciv.models.ruleset.Nation
import com.unciv.models.ruleset.Ruleset
import com.unciv.models.ruleset.RulesetCache
import com.unciv.models.translations.TranslationFileReader
import com.unciv.models.translations.TranslationFileWriter
import com.unciv.models.translations.Translations
import org.junit.Assert
import org.junit.Before
@ -20,7 +17,6 @@ import java.util.*
class TranslationTests {
private var translations = Translations()
private var ruleset = Ruleset()
private val jsonParser = JsonParser()
@Before
fun loadTranslations() {
@ -175,11 +171,12 @@ class TranslationTests {
}
@Test
fun nationsFileIsSerializable() {
val array = jsonParser.getFromJson(emptyArray<Nation>().javaClass, "jsons/Nations.json")
fun translationsFromJSONsCanBeGenerated() {
// it triggers generation of the translation's strings
val stringsSize = TranslationFileWriter.getGeneratedStringsSize()
Assert.assertTrue("This test will only pass when there Nations.json file is serializable",
array.isNotEmpty())
Assert.assertTrue("This test will only pass when all .json files are serializable",
stringsSize > 0)
}
/** For every translatable string find its placeholders and check if all translations have them */
@ -207,7 +204,7 @@ class TranslationTests {
@Test
fun allTranslationsEndWithASpace() {
val templateLines = Gdx.files.internal(TranslationFileReader.templateFileLocation).reader().readLines()
val templateLines = Gdx.files.internal(TranslationFileWriter.templateFileLocation).reader().readLines()
var failed = false
for (line in templateLines) {
if (line.endsWith(" =")) {