Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

CB now treats i18n string and blocks the same

  • Loading branch information...
commit 639bbac2b45e8251e84c93347f7de9f16e7edf07 1 parent 94c43cd
Evan Miller authored
View
5 src/controller/cb_admin_lang_controller.erl
@@ -37,14 +37,13 @@ edit('POST', [App, Lang|Fmt], Auth) ->
lists:map(fun(Message) ->
Original = proplists:get_value("orig", Message),
Translation = proplists:get_value("trans", Message),
- BlockIdentifier = proplists:get_value("identifier", Message),
case Translation of
"" ->
case WithBlanks of
undefined -> ok;
- _ -> cb_admin_lang_lib:lang_write_to_file(IODevice, Original, Translation, BlockIdentifier)
+ _ -> boss_lang:lang_write_to_file(IODevice, Original, Translation)
end;
- _ -> cb_admin_lang_lib:lang_write_to_file(IODevice, Original, Translation, BlockIdentifier)
+ _ -> boss_lang:lang_write_to_file(IODevice, Original, Translation)
end
end, Req:deep_post_param(["messages"])),
file:close(IODevice),
View
31 src/lib/cb_admin_lang_lib.erl
@@ -1,31 +0,0 @@
--module(cb_admin_lang_lib).
--export([lang_write_to_file/4]).
-
-lang_write_to_file(IODevice, Original, Translation, BlockIdentifier) ->
- OriginalEncoded = unicode:characters_to_list(boss_lang:escape_quotes(Original)),
- TranslationEncoded = unicode:characters_to_list(boss_lang:escape_quotes(Translation)),
- case BlockIdentifier of
- undefined ->
- file:write(IODevice, io_lib:format("\nmsgid \"~ts\"\n",[list_to_binary(OriginalEncoded)])),
- file:write(IODevice, io_lib:format("\msgstr \"~ts\"\n",[list_to_binary(TranslationEncoded)]));
- Identifier ->
- file:write(IODevice, io_lib:format("\n#. ~ts\n",[list_to_binary(Identifier)])),
- file:write(IODevice, io_lib:format("msgid \"~s\"\n", [""])),
- {ok, OriginalTokens} = regexp:split(OriginalEncoded,"\r\n"),
- lang_write_multiline_to_file(IODevice, OriginalTokens),
- file:write(IODevice, io_lib:format("\msgstr \"~s\"\n", [""])),
- {ok, TranslationTokens} = regexp:split(TranslationEncoded,"\r\n"),
- lang_write_multiline_to_file(IODevice, TranslationTokens)
- end.
-
-lang_write_multiline_to_file(IODevice, []) -> ok;
-lang_write_multiline_to_file(IODevice, [Token|Rest]) ->
- ParsedToken = case Token of
- [] -> "";
- _ -> Token
- end,
- case Rest of
- [] -> file:write(IODevice, io_lib:format("\"~ts\"\n", [list_to_binary(ParsedToken)]));
- _ -> file:write(IODevice, io_lib:format("\"~ts~c~c\"\n", [list_to_binary(ParsedToken), 92, 110]))
- end,
- lang_write_multiline_to_file(IODevice, Rest).
View
11 src/view/lang/show.html
@@ -107,20 +107,11 @@ <h2 id="untranslated">Untranslated messages</h2>
{% for message in untranslated_messages %}
<tr class="{% cycle 'odd' 'even' %}">
<td>
- {% if message.identifier %}
- <span class="message" id="message{{ forloop.counter0 }}">
- <textarea style="width: 100%;" readonly="readonly">{{ message.string }}</textarea>
- </span>
- <input type="hidden" name="messages[{{ forloop.counter0 }}][orig]" value="{{ message.string|escape }}" />
- <input type="hidden" name="messages[{{ forloop.counter0 }}][identifier]" value="{{ message.identifier }}" />
- <textarea id="trans_message{{ forloop.counter0 }}" name="messages[{{ forloop.counter0 }}][trans]" style="width: 100%;"></textarea>
- {% else %}
<span class="message" id="message{{ forloop.counter0 }}">
<input type="text" style="width: 100%;" value='{{ message }}' readonly="readonly">
</span>
<input type="hidden" name="messages[{{ forloop.counter0 }}][orig]" value="{{ message|escape }}" />
- <input class="trans" id="trans_message{{ forloop.counter0 }}" style="width: 100%;" name="messages[{{ forloop.counter0 }}][trans]" size="60" />
- {% endif %}
+ <textarea id="trans_message{{ forloop.counter0 }}" style="width: 100%;" name="messages[{{ forloop.counter0 }}][trans]" size="60" />
</td>
</tr>
{% endfor %}
Please sign in to comment.
Something went wrong with that request. Please try again.