Initial publication
commit
43616ce3b7
|
@ -0,0 +1,22 @@
|
||||||
|
# Auto detect text files and perform LF normalization
|
||||||
|
* text=auto
|
||||||
|
|
||||||
|
# Custom for Visual Studio
|
||||||
|
*.cs diff=csharp
|
||||||
|
*.sln merge=union
|
||||||
|
*.csproj merge=union
|
||||||
|
*.vbproj merge=union
|
||||||
|
*.fsproj merge=union
|
||||||
|
*.dbproj merge=union
|
||||||
|
|
||||||
|
# Standard to msysgit
|
||||||
|
*.doc diff=astextplain
|
||||||
|
*.DOC diff=astextplain
|
||||||
|
*.docx diff=astextplain
|
||||||
|
*.DOCX diff=astextplain
|
||||||
|
*.dot diff=astextplain
|
||||||
|
*.DOT diff=astextplain
|
||||||
|
*.pdf diff=astextplain
|
||||||
|
*.PDF diff=astextplain
|
||||||
|
*.rtf diff=astextplain
|
||||||
|
*.RTF diff=astextplain
|
|
@ -0,0 +1,163 @@
|
||||||
|
#################
|
||||||
|
## Eclipse
|
||||||
|
#################
|
||||||
|
|
||||||
|
*.pydevproject
|
||||||
|
.project
|
||||||
|
.metadata
|
||||||
|
bin/
|
||||||
|
tmp/
|
||||||
|
*.tmp
|
||||||
|
*.bak
|
||||||
|
*.swp
|
||||||
|
*~.nib
|
||||||
|
local.properties
|
||||||
|
.classpath
|
||||||
|
.settings/
|
||||||
|
.loadpath
|
||||||
|
|
||||||
|
# External tool builders
|
||||||
|
.externalToolBuilders/
|
||||||
|
|
||||||
|
# Locally stored "Eclipse launch configurations"
|
||||||
|
*.launch
|
||||||
|
|
||||||
|
# CDT-specific
|
||||||
|
.cproject
|
||||||
|
|
||||||
|
# PDT-specific
|
||||||
|
.buildpath
|
||||||
|
|
||||||
|
|
||||||
|
#################
|
||||||
|
## Visual Studio
|
||||||
|
#################
|
||||||
|
|
||||||
|
## Ignore Visual Studio temporary files, build results, and
|
||||||
|
## files generated by popular Visual Studio add-ons.
|
||||||
|
|
||||||
|
# User-specific files
|
||||||
|
*.suo
|
||||||
|
*.user
|
||||||
|
*.sln.docstates
|
||||||
|
|
||||||
|
# Build results
|
||||||
|
[Dd]ebug/
|
||||||
|
[Rr]elease/
|
||||||
|
*_i.c
|
||||||
|
*_p.c
|
||||||
|
*.ilk
|
||||||
|
*.meta
|
||||||
|
*.obj
|
||||||
|
*.pch
|
||||||
|
*.pdb
|
||||||
|
*.pgc
|
||||||
|
*.pgd
|
||||||
|
*.rsp
|
||||||
|
*.sbr
|
||||||
|
*.tlb
|
||||||
|
*.tli
|
||||||
|
*.tlh
|
||||||
|
*.tmp
|
||||||
|
*.vspscc
|
||||||
|
.builds
|
||||||
|
*.dotCover
|
||||||
|
|
||||||
|
## TODO: If you have NuGet Package Restore enabled, uncomment this
|
||||||
|
#packages/
|
||||||
|
|
||||||
|
# Visual C++ cache files
|
||||||
|
ipch/
|
||||||
|
*.aps
|
||||||
|
*.ncb
|
||||||
|
*.opensdf
|
||||||
|
*.sdf
|
||||||
|
|
||||||
|
# Visual Studio profiler
|
||||||
|
*.psess
|
||||||
|
*.vsp
|
||||||
|
|
||||||
|
# ReSharper is a .NET coding add-in
|
||||||
|
_ReSharper*
|
||||||
|
|
||||||
|
# Installshield output folder
|
||||||
|
[Ee]xpress
|
||||||
|
|
||||||
|
# DocProject is a documentation generator add-in
|
||||||
|
DocProject/buildhelp/
|
||||||
|
DocProject/Help/*.HxT
|
||||||
|
DocProject/Help/*.HxC
|
||||||
|
DocProject/Help/*.hhc
|
||||||
|
DocProject/Help/*.hhk
|
||||||
|
DocProject/Help/*.hhp
|
||||||
|
DocProject/Help/Html2
|
||||||
|
DocProject/Help/html
|
||||||
|
|
||||||
|
# Click-Once directory
|
||||||
|
publish
|
||||||
|
|
||||||
|
# Others
|
||||||
|
[Bb]in
|
||||||
|
[Oo]bj
|
||||||
|
sql
|
||||||
|
TestResults
|
||||||
|
*.Cache
|
||||||
|
ClientBin
|
||||||
|
stylecop.*
|
||||||
|
~$*
|
||||||
|
*.dbmdl
|
||||||
|
Generated_Code #added for RIA/Silverlight projects
|
||||||
|
|
||||||
|
# Backup & report files from converting an old project file to a newer
|
||||||
|
# Visual Studio version. Backup files are not needed, because we have git ;-)
|
||||||
|
_UpgradeReport_Files/
|
||||||
|
Backup*/
|
||||||
|
UpgradeLog*.XML
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
############
|
||||||
|
## Windows
|
||||||
|
############
|
||||||
|
|
||||||
|
# Windows image file caches
|
||||||
|
Thumbs.db
|
||||||
|
|
||||||
|
# Folder config file
|
||||||
|
Desktop.ini
|
||||||
|
|
||||||
|
|
||||||
|
#############
|
||||||
|
## Python
|
||||||
|
#############
|
||||||
|
|
||||||
|
*.py[co]
|
||||||
|
|
||||||
|
# Packages
|
||||||
|
*.egg
|
||||||
|
*.egg-info
|
||||||
|
dist
|
||||||
|
build
|
||||||
|
eggs
|
||||||
|
parts
|
||||||
|
bin
|
||||||
|
var
|
||||||
|
sdist
|
||||||
|
develop-eggs
|
||||||
|
.installed.cfg
|
||||||
|
|
||||||
|
# Installer logs
|
||||||
|
pip-log.txt
|
||||||
|
|
||||||
|
# Unit test / coverage reports
|
||||||
|
.coverage
|
||||||
|
.tox
|
||||||
|
|
||||||
|
#Translations
|
||||||
|
*.mo
|
||||||
|
|
||||||
|
#Mr Developer
|
||||||
|
.mr.developer.cfg
|
||||||
|
|
||||||
|
# Mac crap
|
||||||
|
.DS_Store
|
|
@ -0,0 +1,50 @@
|
||||||
|
Minetest 0.4 mod: localisation
|
||||||
|
==============================
|
||||||
|
|
||||||
|
License of source code:
|
||||||
|
-----------------------
|
||||||
|
Copyright (C) 2011-2012 Jonjeg <jonathan.jegouzo@gmail.com>
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
http://www.gnu.org/licenses/lgpl-2.1.html
|
||||||
|
|
||||||
|
Description:
|
||||||
|
------------
|
||||||
|
This mod allow mod devellopers to publish their mod in differents
|
||||||
|
language with less work needed.
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
------
|
||||||
|
|
||||||
|
The minetest setting 'language' is set to EN when this mod is first loaded.
|
||||||
|
You can modify it in your minetest.conf.
|
||||||
|
If no translation is found for a message, his english counterpart is used instead.
|
||||||
|
If no english counterpart are found, then an error message is returned.
|
||||||
|
|
||||||
|
Exemple(Code lua) :
|
||||||
|
-------------------
|
||||||
|
local translations = {
|
||||||
|
EN = {
|
||||||
|
message1 = "english version",
|
||||||
|
message_with_parameter = "$1 will be replaced by the first additionnal parameter",
|
||||||
|
message_existing_in_english_only = "lorem ipsum"
|
||||||
|
...etc
|
||||||
|
},
|
||||||
|
FR = {
|
||||||
|
message1 = "version française"
|
||||||
|
message_with_parameter = "$1 va être remplacé par la 1ère valeur additionnelle"
|
||||||
|
message_with_some_parameters = "$1,$2,$3"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
translate(translations,"message1") -> "english version" -- si language = EN
|
||||||
|
translate(translations,"message1") -> "version française" -- si language = FR
|
||||||
|
translate(translations,"message1") -> "english version" -- si language = other than FR
|
||||||
|
translate(translations,"message_existing_in_english_only") -> "lorem ipsum"
|
||||||
|
translate(translations,"message_with_parameter","value") -> "value will be replaced by the first additionnal parameter" -- si language = EN
|
||||||
|
translate(translations,"message_with_parameter","value") -> "value va être remplacé par la 1ère valeur additionnelle" -- si language = FR
|
||||||
|
translate(translations,"message_with_some_parameters","value",2,3.5) -> "value,2,3.5"
|
||||||
|
translate(translations,"message_inexistant","value",2,3.5) -> "Translate(EN,message_inexistant) = No translations available"
|
|
@ -0,0 +1 @@
|
||||||
|
default
|
|
@ -0,0 +1,38 @@
|
||||||
|
-- Minetest 0.4 mod: localisation
|
||||||
|
-- See README.txt for licensing and other information.
|
||||||
|
-- LOCALISATION
|
||||||
|
if minetest.setting_get("language") == nil then
|
||||||
|
minetest.setting_set("language", "EN")
|
||||||
|
end
|
||||||
|
|
||||||
|
function translate(label_list,msg_label,...)
|
||||||
|
local function translation(label_list,language,msg_label,...)
|
||||||
|
local msg = label_list[language][msg_label]
|
||||||
|
local args = {...}
|
||||||
|
for key,arg in ipairs(args) do
|
||||||
|
msg = string.gsub(msg, "%$"..key.."", arg)
|
||||||
|
end
|
||||||
|
return msg
|
||||||
|
end
|
||||||
|
local function err(language,msg_label)
|
||||||
|
return "Translate("..language..","..msg_label..") = No translations available"
|
||||||
|
end
|
||||||
|
local language = minetest.setting_get("language") -- has previously been defined as EN if not set
|
||||||
|
local fallback = "EN"
|
||||||
|
if label_list[language] == nil then
|
||||||
|
-- Fallback on english
|
||||||
|
language = fallback
|
||||||
|
if label_list[language] == nil then
|
||||||
|
return
|
||||||
|
end err(language,msg_label)
|
||||||
|
else
|
||||||
|
if label_list[language][msg_label] == nil then
|
||||||
|
if language == fallback then
|
||||||
|
return err(language,msg_label)
|
||||||
|
else
|
||||||
|
return translation(label_list,fallback,msg_label,...)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return translation(label_list,language,msg_label,...)
|
||||||
|
end
|
Loading…
Reference in New Issue