diff --git a/README.md b/README.md index 500627c..4676072 100644 --- a/README.md +++ b/README.md @@ -6,8 +6,8 @@

Internationalization of texts simply and quickly, using JSON files

- - Release v0.1.0 + + Release v0.2.0 Follow @CreativeHandOf @@ -140,6 +140,28 @@ Returns an array with all the locations configured during setup getLocales(); ``` +--- +## Contributors + + +

+ + + + + +
+ + +
+ + Juju Adams + +
+
+ 🌈
+
+ --- ## Author @@ -150,10 +172,16 @@ getLocales(); Coded By - + +
+ + Ramon Barbosa +
+
+ 🕹ī¸ diff --git a/scripts/gmi18n/gmi18n.gml b/scripts/gmi18n/gmi18n.gml index c98a4af..a9b0cbc 100644 --- a/scripts/gmi18n/gmi18n.gml +++ b/scripts/gmi18n/gmi18n.gml @@ -142,7 +142,7 @@ function handleFallBackLocaleFile() { } - //Clear the string cache + // Clear the string cache ds_map_clear(global.__localizationStringCache); global.__translatorFallBackLocale = _translator; @@ -174,7 +174,7 @@ function handleTranslatorFile() { throw "Incorrect " + _file + " format"; } - //Clear the string cache + // Clear the string cache ds_map_clear(global.__localizationStringCache); global.__translator = _translator; @@ -226,7 +226,7 @@ function useTranslation(_param) { _translatorFallBackLocale = undefined, _input_param = _param; - //Check the string cache and, if we find a cached result, return it + // Check the string cache and, if we find a cached result, return it if (ds_map_exists(global.__localizationStringCache, _input_param)) { return global.__localizationStringCache[? _input_param]; } diff --git a/scripts/utilsGmI18n/utilsGmI18n.gml b/scripts/utilsGmI18n/utilsGmI18n.gml index fdb2e7a..ac97255 100644 --- a/scripts/utilsGmI18n/utilsGmI18n.gml +++ b/scripts/utilsGmI18n/utilsGmI18n.gml @@ -1,10 +1,6 @@ /// @function importJson(file_name, func) /// @param {string} _file_name the file to get the json data from /// @param {func} _func the function to use on the string -/// @description imports json data form a file. Pass json_decode -/// to return the data as maps and lists. Pass json_parse to -/// return the data as arrays and structs. -/// @author https://github.com/samspadegamedev function importJson(_file_name, _func) { if (file_exists(_file_name)) { var _buffer = buffer_load(_file_name); @@ -20,14 +16,10 @@ function importJson(_file_name, _func) { /// @param {string} _file_name the file to save the json data to /// @param {struct/array/map} _data the data to save as json data /// @param {func} _func the function to use on the data -/// @description saves json data to a file. Pass a map and json_encode -/// to return save json data stored as maps and lists. Pass an -/// array or struct and json_parse to save the data stored -/// as arrays and structs. -/// @author https://github.com/samspadegamedev function exportJson(_file_name, _data, _func) { - var _buffer = buffer_create(string_byte_length(_data)+1, buffer_fixed, 1); - buffer_write(_buffer, buffer_string, script_execute(_func, _data)); + var _data_string = script_execute(_func, _data); + var _buffer = buffer_create(string_byte_length(_data_string) + 1, buffer_fixed, 1); + buffer_write(_buffer, buffer_string, _data_string); buffer_save(_buffer, _file_name); }