Subversion Repository Public Repository


This repository has no backups
This repository's network speed is throttled to 100KB/sec

#include "Headers/Localization.h"

#include "Core/Headers/Application.h"
#include <SimpleIni.h>

namespace Divide {
namespace Locale {
    char* get(const stringImpl& key, const stringImpl& defaultValue) {
        //When we ask for a string for the given key, we check our language cache first
        if(_languageTable.find(key) != _languageTable.end()){
            //Usually, the entire language table is loaded.
            return (char*)_languageTable[key].c_str();
        //If we did not find our key in the cache, we need to populate the cache table
        //This may occur, for example, on language change
        stringImpl file = "localisation/" + _localeFile + ".ini";
        //Use SimpleIni library for cross-platform INI parsing
        CSimpleIniA ini;
        if (ini.LoadFile(file.c_str()) != SI_OK) {
        //Load all key-value pairs for the "language" section
        const CSimpleIni::TKeyVal * keyValue = ini.GetSection("language");
        if (keyValue) {
            //And add all pairs to the language table
            CSimpleIni::TKeyVal::const_iterator keyValuePairIt = keyValue->begin();
            for ( ;keyValuePairIt != keyValue->end(); ++keyValuePairIt) {
                hashAlg::emplace(_languageTable, stringImpl(keyValuePairIt->first.pItem), stringImpl(keyValuePairIt->second));
            _languageTable[key] = defaultValue;
            assert(_languageTable[key].compare("String not found!") != 0 && "Locale error: INVALID STRING KEY!");
        //Return our desired value now
        return (char*)_languageTable[key].c_str();
}; //namespace Locale
}; //namespace Divide

Commits for Divide-Framework/trunk/Source Code/Utility/Localization.cpp

Diff revisions: vs.
Revision Author Commited Message
337 Diff Diff IonutCava picture IonutCava Wed 17 Dec, 2014 17:25:16 +0000

- Replaced all tabs with 4 spaces (some spacing may be off now. no way to check all the files.)
- Moved implementation details for ParamHandler, BoundingBox, BoundingSphere and ProfileTimer to proper .inl and .cpp files. (more to follow)
- Update all forward declared enums with the required storage type (as requested by the C++11 standard)

333 Diff Diff IonutCava picture IonutCava Tue 09 Dec, 2014 16:15:44 +0000

- Removed “core.h” and moved everything to their appropriate header files
- Renamed MathClasses to MathMatrices (finally)
- Renamed “-Inl.h” files to ".inl"
- Some String wrapper refactoring
- Update “InstallLibraries.bat” so that it still offers valid options

326 Diff Diff IonutCava picture IonutCava Tue 30 Sep, 2014 21:11:32 +0000

- Fixed more memory leaks
- Simplified Task interface and timing System
- Improved compatibility between Boost, STL and EASTL with random combinations of vectors, strings and maps
- Simplified Light class by removing the “slot” member
- Random optimizations

321 Diff Diff IonutCava picture IonutCava Wed 03 Sep, 2014 22:05:15 +0000

- Added support (and enabled by default) for the EASTL library ( /
— Strings, vectors and hash_maps can be combined from EASTL, STL and Boost (not all combinations work. e.g. EASTL strings with STL/Boost containers due to the lack of a proper hash function)

319 Diff Diff IonutCava picture IonutCava Sat 30 Aug, 2014 21:37:57 +0000

- Performance tweaks based on profiling data

318 Diff Diff IonutCava picture IonutCava Sat 30 Aug, 2014 17:35:53 +0000

- Wrapped the entire code in a “Divide” namespace
- VertexBuffers now call “shrink_to_fit” on all internal data storage
- Improved some vector performance by preferring “emplace_back” instead of “push_back” + proepr usage of reserve / resize
- Wrapped OIS specific types and classes in Divide::Input namespace
- Added the messageBox.layout file (forgot it in the previous few commits)

314 Diff Diff IonutCava picture IonutCava Sun 24 Aug, 2014 19:54:33 +0000

- More AI work
- Added some needed audio dlls

273 Diff Diff IonutCava picture IonutCava Wed 11 Jun, 2014 20:34:00 +0000

[Ionut] [[BR]]
- Improved batching part2: [[BR]]
— Moved all bone transformation matrices upload from uniform functions in SceneNode to Shader Storage Buffers in AnimationController class with updates controlled by SceneGraphNode’s AnimationComponent [[BR]]
-— No double-buffering or efficient mapping of data yet. Just raw buffer updates [[BR]]
— Replaced all RenderStateBlock* pointers with I64 hash values [[BR]]
-— Will be used later in draw commands as per-shader state hash [[BR]]
— Moved getShaderProgram from Material to Material::ShaderInfo [[BR]]
-— Improved redundant uniform checks [[BR]]
— Improved texture unit changing in case of redundant texture bind case (i.e. skip changing the texture unit) [[BR]]
- Improved float and double comparison functions using algorithms described in [[BR]]
- Added a new utility function, DIVIDE_ASSERT, to more easily bind an assert check with a specific message [[BR]]
- Added missing files from Forward+ renderer’s initial code [[BR]]

259 Diff Diff k1ngp1n picture k1ngp1n Sun 27 Apr, 2014 18:24:52 +0000

- Implemented Exponential Stable Cascaded Shadow Maps for directional lights (still buggy, but basically working) [[BR]]
— CSM settings (resolution, number of splits, etc) are part of the scene render state [[BR]]
- SGN can skip rendering for the current frame if they are not ready (e.g. OnDraw can now return false or materials can fail to bind) [[BR]]
- Frustum class is now using the Plane class [[BR]]
- Removed Math SIMD implementation as the compiler generated code will always be faster and safer [[BR]]
- Added a “STUBBED” macro for outputing to the error stream of important messages (instead of using #pragma message) [[BR]]
- Added “freeze time” logic to pause/resume updates with or without freezing the GUI too [[BR]]
- Added “processGUI” method the every Scene class to separate time-sensitive GUI updates from game logic loop [[BR]]
- GLSL <-> Vertex Buffer bind locations are automatically set for every vertex shader [[BR]]
- Added basic support for compute shaders [[BR]]
- Removed most OS define checks to make porting to a new platform easier [[BR]]
- Texture transparency check per-pixel is now using OpenMP [[BR]]
- Texture samplers can now set a border color for CLAMP_TO_BORDER wrap mode [[BR]]
- Removed “Object” suffix from GFX Classes (pixel buffer, vertex buffer, frame buffer, etc) [[BR]]
- Stop processing scene input when application looses focus [[BR]]
- SceneGraphNode class is now responsible for updating SGNComponents on draw and calling its _node’s OnDraw method [[BR]]
- UBOs can now list all of the active uniforms inside a block with info such as type and offset [[BR]]
- Removed deprecated ‘GLCheck’ macro [[BR]]
- A lot of bug fixes and performance improvements in various places [[BR]]

171 k1ngp1n picture k1ngp1n Sun 03 Nov, 2013 18:15:06 +0000

-Replaced all tabs with spaces [[BR]]