-module(json). -compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]). -export([read_file/1]). -spec read_file(binary()) -> {ok, gleam@dict:dict(binary(), gleam@dict:dict(binary(), binary()))} | {error, error:translator_error()}. read_file(Directory) -> File = begin _pipe = Directory, _pipe@1 = gleam@string:append(_pipe, <<"/"/utf8>>), gleam@string:append(_pipe@1, <<"lang.json"/utf8>>) end, gleam@result:'try'( begin _pipe@2 = simplifile:read(File), gleam@result:map_error( _pipe@2, fun(Field@0) -> {file_error, Field@0} end ) end, fun(Json_content) -> Decoder = gleam@dynamic:dict( fun gleam@dynamic:string/1, gleam@dynamic:dict( fun gleam@dynamic:string/1, fun gleam@dynamic:string/1 ) ), gleam@result:'try'( gleam@result:map_error( gleam@json:decode(Json_content, Decoder), fun(Field@0) -> {json_error, Field@0} end ), fun(Translations) -> {ok, Translations} end ) end ).